screenshotscout 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a670447d2ee6dc8b14865d9161623661cdcd7f8ca0139a5741d61872821d05a
4
- data.tar.gz: 9c514cbb7f1f5e0eabc76669c7a83faffbcff07501689749238c6f527dbaa6cb
3
+ metadata.gz: a4b2c581974498206ab874e1e4cfaf78906b16ab7c3c5924332e71d8919c244d
4
+ data.tar.gz: 6f306fd3cf1f62be26e8a0da90b42a0a719a0987d71e9e64a59b3c52a60e860d
5
5
  SHA512:
6
- metadata.gz: d3606891244c9ec6eb473af8eda9ff48d07b4990ff7263e577920ddf8db12abc787a177bccf8448d3e64f9396640378a2a2e16e0c57f3e78e330d06dbaac5066
7
- data.tar.gz: 4e07a85d4ed239504f3629f4d897f93585cbc32c5279898e4819f3b3346c1a6cc4eadecabe5b652504b26d775af5aeb9990dc690f8bbb470a13c51927c159378
6
+ metadata.gz: bdfe6741ed611e68ca8388ede177ad21438dcac59aa836b51c7a561c73f7d708ef976ee03c0539359472c50ba02127210e9ac1e5492e384657d24c2c8ef3cb46
7
+ data.tar.gz: 2584fbe9013650194b7193dc20c1ae3ffd7ce4e11ad1a8ed64a068fd8b28b42c639da09be360315584d4713c7275985033b4c3545da4dcbfbe87d7f748b4a52f
data/README.md CHANGED
@@ -181,7 +181,8 @@ for service behavior and allowed values.
181
181
  The `timeout` capture option controls how long Screenshot Scout may spend capturing the page. It
182
182
  does not configure your application's HTTP timeout.
183
183
 
184
- Most applications can use the default `NetHttpTransport`. To customize HTTP timeouts, proxies,
184
+ Most applications can use the default `NetHttpTransport`. It waits up to 300 seconds for response
185
+ data, longer than the longest capture Screenshot Scout allows. To customize HTTP timeouts, proxies,
185
186
  TLS, or logging, pass an object with a `call(request)` method. It receives a `TransportRequest` and
186
187
  returns a `RawResponse`:
187
188
 
@@ -21,13 +21,14 @@ module ScreenshotScout
21
21
 
22
22
  # Small default adapter. It owns each Net::HTTP session that it opens.
23
23
  class NetHttpTransport
24
+ # Longer than the longest capture Screenshot Scout allows (240 seconds). Net::HTTP waits 60.
25
+ READ_TIMEOUT_SECONDS = 300
26
+ private_constant :READ_TIMEOUT_SECONDS
27
+
24
28
  def call(request)
25
29
  uri = URI.parse(request.url)
26
30
  net_request = build_request(uri, request)
27
- http = Net::HTTP.new(uri.host, uri.port, nil)
28
- http.use_ssl = uri.scheme == "https"
29
- http.max_retries = 0
30
- response = http.start { |session| session.request(net_request) }
31
+ response = build_session(uri).start { |session| session.request(net_request) }
31
32
 
32
33
  RawResponse.new(
33
34
  status: response.code.to_i,
@@ -40,6 +41,14 @@ module ScreenshotScout
40
41
 
41
42
  private
42
43
 
44
+ def build_session(uri)
45
+ http = Net::HTTP.new(uri.host, uri.port, nil)
46
+ http.use_ssl = uri.scheme == "https"
47
+ http.read_timeout = READ_TIMEOUT_SECONDS
48
+ http.max_retries = 0
49
+ http
50
+ end
51
+
43
52
  def build_request(uri, request)
44
53
  net_request = case request.method
45
54
  when CaptureHttpMethod::GET
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ScreenshotScout
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: screenshotscout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleksii Velykyi