mechanize 2.13.0 → 2.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/mechanize/http/agent.rb +7 -0
- data/lib/mechanize/version.rb +1 -1
- data/lib/mechanize.rb +15 -0
- data/test/test_mechanize.rb +9 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00134b35e4583ae30a00b320468fa362e7290bced2f030a3e02544848f58cde6
|
4
|
+
data.tar.gz: babed05130568f0a4c306ccaa77da706334bafbd3fe898c961af5e4faaa98c03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26e8e71a37e1811cfd108c3947d6eaac79576128e2b684e9b1e1d32ee83270f93b4c912b5fa8a324fb643b28dc423ed88ad95bad6efc904fe3af592d9d179844
|
7
|
+
data.tar.gz: 20ae7f34891ff7dd2284831acad91789656c6817d70577de885744d419ac447d8fac5cb6d7f2e609624835f2b506a85cbd5ba20f6881ae6d402f6b17ae460b82
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Mechanize CHANGELOG
|
2
2
|
|
3
|
+
## 2.14.0 / 2025-01-05
|
4
|
+
|
5
|
+
* `Mechanize` exposes a `write_timeout` attribute, which is set on the connection if it's supported (e.g., `Net::HTTP::Persistent.write_timeout`). (#586) @maurycy
|
6
|
+
|
7
|
+
|
3
8
|
## 2.13.0 / 2025-01-02
|
4
9
|
|
5
10
|
* Quash frozen string warnings in Ruby 3.4. (#661) @simpl1g
|
data/lib/mechanize/http/agent.rb
CHANGED
@@ -106,6 +106,9 @@ class Mechanize::HTTP::Agent
|
|
106
106
|
# Length of time to attempt to read data from the server
|
107
107
|
attr_accessor :read_timeout
|
108
108
|
|
109
|
+
# Length of time to attempt to write data to the server
|
110
|
+
attr_accessor :write_timeout
|
111
|
+
|
109
112
|
# :section:
|
110
113
|
|
111
114
|
# The cookies for this agent
|
@@ -161,6 +164,7 @@ class Mechanize::HTTP::Agent
|
|
161
164
|
@robots_mutex = Mutex.new
|
162
165
|
@user_agent = nil
|
163
166
|
@webrobots = nil
|
167
|
+
@write_timeout = nil
|
164
168
|
|
165
169
|
# HTTP Authentication
|
166
170
|
@auth_store = Mechanize::HTTP::AuthStore.new
|
@@ -274,6 +278,9 @@ class Mechanize::HTTP::Agent
|
|
274
278
|
if @read_timeout && connection.respond_to?(:read_timeout=)
|
275
279
|
connection.read_timeout = @read_timeout
|
276
280
|
end
|
281
|
+
if @write_timeout && connection.respond_to?(:write_timeout=)
|
282
|
+
connection.write_timeout = @write_timeout
|
283
|
+
end
|
277
284
|
|
278
285
|
request_log request
|
279
286
|
|
data/lib/mechanize/version.rb
CHANGED
data/lib/mechanize.rb
CHANGED
@@ -951,6 +951,21 @@ Use of #auth and #basic_auth are deprecated due to a security vulnerability.
|
|
951
951
|
@agent.read_timeout = read_timeout
|
952
952
|
end
|
953
953
|
|
954
|
+
##
|
955
|
+
# Length of time to wait for data to be sent to the server
|
956
|
+
|
957
|
+
def write_timeout
|
958
|
+
@agent.write_timeout
|
959
|
+
end
|
960
|
+
|
961
|
+
##
|
962
|
+
# Sets the timeout for each chunk of data to be sent to the server to
|
963
|
+
# +write_timeout+. A single request may write many chunks of data.
|
964
|
+
|
965
|
+
def write_timeout= write_timeout
|
966
|
+
@agent.write_timeout = write_timeout
|
967
|
+
end
|
968
|
+
|
954
969
|
##
|
955
970
|
# Controls how mechanize deals with redirects. The following values are
|
956
971
|
# allowed:
|
data/test/test_mechanize.rb
CHANGED
@@ -1016,8 +1016,16 @@ but not <a href="/" rel="me nofollow">this</a>!
|
|
1016
1016
|
|
1017
1017
|
def test_read_timeout_equals
|
1018
1018
|
@mech.read_timeout = 5
|
1019
|
-
|
1020
1019
|
assert_equal 5, @mech.read_timeout
|
1020
|
+
assert @mech.get('http://localhost/response_code?code=200')
|
1021
|
+
assert_equal 5, @mech.agent.http.read_timeout
|
1022
|
+
end
|
1023
|
+
|
1024
|
+
def test_write_timeout_equals
|
1025
|
+
@mech.write_timeout = 7
|
1026
|
+
assert_equal 7, @mech.write_timeout
|
1027
|
+
assert @mech.get('http://localhost/response_code?code=200')
|
1028
|
+
assert_equal 7, @mech.agent.http.write_timeout
|
1021
1029
|
end
|
1022
1030
|
|
1023
1031
|
def test_timeouts_for_file_connection
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mechanize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Hodel
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
- Lee Jarvis
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2025-01-
|
14
|
+
date: 2025-01-05 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: addressable
|