mechanize 2.14.1 → 2.14.3
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 +4 -4
- data/CHANGELOG.md +25 -1
- data/lib/mechanize/directory_saver.rb +2 -1
- data/lib/mechanize/file_saver.rb +2 -0
- data/lib/mechanize/form.rb +82 -57
- data/lib/mechanize/parser.rb +33 -3
- data/lib/mechanize/test_case.rb +2 -9
- data/lib/mechanize/version.rb +1 -1
- data/lib/mechanize.rb +9 -9
- metadata +3 -172
- data/.autotest +0 -6
- data/.github/dependabot.yml +0 -11
- data/.github/workflows/ci.yml +0 -43
- data/.github/workflows/upstream.yml +0 -51
- data/.gitignore +0 -15
- data/.yardopts +0 -8
- data/Gemfile +0 -12
- data/Rakefile +0 -56
- data/examples/flickr_upload.rb +0 -22
- data/examples/latest_user_agents.rb +0 -100
- data/examples/mech-dump.rb +0 -5
- data/examples/proxy_req.rb +0 -7
- data/examples/rubygems.rb +0 -23
- data/examples/spider.rb +0 -22
- data/examples/wikipedia_links_to_philosophy.rb +0 -158
- data/mechanize.gemspec +0 -74
- data/test/data/htpasswd +0 -1
- data/test/data/server.crt +0 -16
- data/test/data/server.csr +0 -12
- data/test/data/server.key +0 -15
- data/test/data/server.pem +0 -15
- data/test/test_mechanize.rb +0 -1382
- data/test/test_mechanize_cookie.rb +0 -559
- data/test/test_mechanize_cookie_jar.rb +0 -615
- data/test/test_mechanize_directory_saver.rb +0 -60
- data/test/test_mechanize_download.rb +0 -102
- data/test/test_mechanize_element_not_found_error.rb +0 -16
- data/test/test_mechanize_file.rb +0 -118
- data/test/test_mechanize_file_connection.rb +0 -40
- data/test/test_mechanize_file_request.rb +0 -26
- data/test/test_mechanize_file_response.rb +0 -48
- data/test/test_mechanize_file_saver.rb +0 -22
- data/test/test_mechanize_form.rb +0 -1025
- data/test/test_mechanize_form_check_box.rb +0 -49
- data/test/test_mechanize_form_encoding.rb +0 -110
- data/test/test_mechanize_form_field.rb +0 -78
- data/test/test_mechanize_form_file_upload.rb +0 -21
- data/test/test_mechanize_form_image_button.rb +0 -13
- data/test/test_mechanize_form_keygen.rb +0 -34
- data/test/test_mechanize_form_multi_select_list.rb +0 -98
- data/test/test_mechanize_form_option.rb +0 -60
- data/test/test_mechanize_form_radio_button.rb +0 -96
- data/test/test_mechanize_form_select_list.rb +0 -81
- data/test/test_mechanize_form_textarea.rb +0 -53
- data/test/test_mechanize_headers.rb +0 -36
- data/test/test_mechanize_history.rb +0 -104
- data/test/test_mechanize_http_agent.rb +0 -2145
- data/test/test_mechanize_http_auth_challenge.rb +0 -64
- data/test/test_mechanize_http_auth_realm.rb +0 -56
- data/test/test_mechanize_http_auth_store.rb +0 -233
- data/test/test_mechanize_http_content_disposition_parser.rb +0 -167
- data/test/test_mechanize_http_www_authenticate_parser.rb +0 -204
- data/test/test_mechanize_image.rb +0 -9
- data/test/test_mechanize_link.rb +0 -171
- data/test/test_mechanize_page.rb +0 -295
- data/test/test_mechanize_page_encoding.rb +0 -215
- data/test/test_mechanize_page_frame.rb +0 -17
- data/test/test_mechanize_page_image.rb +0 -191
- data/test/test_mechanize_page_link.rb +0 -377
- data/test/test_mechanize_page_meta_refresh.rb +0 -151
- data/test/test_mechanize_parser.rb +0 -316
- data/test/test_mechanize_pluggable_parser.rb +0 -68
- data/test/test_mechanize_redirect_limit_reached_error.rb +0 -25
- data/test/test_mechanize_redirect_not_get_or_head_error.rb +0 -15
- data/test/test_mechanize_response_read_error.rb +0 -29
- data/test/test_mechanize_subclass.rb +0 -23
- data/test/test_mechanize_util.rb +0 -144
- data/test/test_mechanize_xml_file.rb +0 -30
- data/test/test_multi_select.rb +0 -120
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e4bea9b72a48d68e5cc8fce815e2e3b9b39ee4bed122fbf79b2caa1ebbbb1204
|
|
4
|
+
data.tar.gz: 152d668a69b5f95d3ad4a3ab8081b84804dbef39dc32986fcba0c02a6ec6c276
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 19a25078306fa1a403a02c702dd5773abab8d639f51ee06e4a24fd9113b1f896c9d85d2dad17e785acd4b14dc42c1dc1aa86af855756ff91988cceb9fa5785aa
|
|
7
|
+
data.tar.gz: 0dae28adc85617e2237d890e9a6b49448f381b8efc5977caa1f8900a15347196a0e1b6c85e06fb916b02b5df022b2411df76d948b79be06a9f0035ae51ed5521
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Mechanize CHANGELOG
|
|
2
2
|
|
|
3
|
+
## next / unreleased
|
|
4
|
+
|
|
5
|
+
## 2.14.3 / 2026-11-30
|
|
6
|
+
|
|
7
|
+
### Security and Performance
|
|
8
|
+
|
|
9
|
+
* `Mechanize::Form#build_query`, which form submission calls, no longer takes quadratic time in the number of form controls. [GHSA-wqj4-7642-gwqw](https://github.com/sparklemotion/mechanize/security/advisories/GHSA-wqj4-7642-gwqw)
|
|
10
|
+
|
|
11
|
+
### Improved
|
|
12
|
+
|
|
13
|
+
* Updated User-Agent strings to represent modern browser versions. (#679) @takatea
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## 2.14.2 / 2026-10-26
|
|
17
|
+
|
|
18
|
+
### Security
|
|
19
|
+
|
|
20
|
+
* A malicious server can no longer make `Mechanize::FileSaver`, or `Mechanize::DirectorySaver` with `decode_filename: true`, write files outside the save directory. Only applications that register one of these as a pluggable parser are affected. [GHSA-hxgc-9476-fc65](https://github.com/sparklemotion/mechanize/security/advisories/GHSA-hxgc-9476-fc65)
|
|
21
|
+
|
|
22
|
+
### Improved
|
|
23
|
+
|
|
24
|
+
* The gem no longer packages the test suite, the test certificates, or the example scripts, which makes it about a third smaller. It still packages `test/htdocs/`, which `Mechanize::TestCase` needs. (#667) @yuri-zubov
|
|
25
|
+
* `Mechanize::TestCase` fake responses work with `net-http` 0.10.0 and later, which reads response lines with `Net::BufferedIO#readuntil`. Previously a chunked response body raised `NoMethodError`. The fake socket is now a `Net::BufferedIO`, like a real one, so `read_body` yields fragments of at most 16 KiB, and a body shorter than its `Content-Length` raises `EOFError` when `ignore_eof` is false.
|
|
26
|
+
|
|
27
|
+
|
|
3
28
|
## 2.14.1 / 2026-08-22
|
|
4
29
|
|
|
5
30
|
### Security
|
|
@@ -1147,4 +1172,3 @@ Mechanize is now under the MIT license
|
|
|
1147
1172
|
* Added a response code exception
|
|
1148
1173
|
* Thanks to Brian Ellin (brianellin@gmail.com) for:
|
|
1149
1174
|
Added support for CA files, and support for 301 response codes
|
|
1150
|
-
|
|
@@ -64,8 +64,9 @@ class Mechanize::DirectorySaver < Mechanize::Download
|
|
|
64
64
|
|
|
65
65
|
super
|
|
66
66
|
|
|
67
|
-
@filename = CGI.unescape(@filename) if self.class.decode_filename?
|
|
67
|
+
@filename = CGI.unescape(@filename).tr('/\\', '_') if self.class.decode_filename?
|
|
68
68
|
path = File.join directory, @filename
|
|
69
|
+
ensure_within directory, path
|
|
69
70
|
|
|
70
71
|
if self.class.overwrite?
|
|
71
72
|
save! path
|
data/lib/mechanize/file_saver.rb
CHANGED
data/lib/mechanize/form.rb
CHANGED
|
@@ -20,6 +20,15 @@ class Mechanize::Form
|
|
|
20
20
|
extend Forwardable
|
|
21
21
|
extend Mechanize::ElementMatcher
|
|
22
22
|
|
|
23
|
+
# Finds every control in document order, in linear time. It is one
|
|
24
|
+
# predicate on the descendant axis because a union such as "input, textarea"
|
|
25
|
+
# makes libxml2 sort the results by comparing nodes, which takes quadratic
|
|
26
|
+
# time. Matching local-name() finds what Nokogiri's CSS search finds under
|
|
27
|
+
# HTML5 and in an XHTML default namespace.
|
|
28
|
+
CONTROLS_XPATH = "./descendant::*[" \
|
|
29
|
+
"local-name()='input' or local-name()='textarea' or local-name()='select' or " \
|
|
30
|
+
"local-name()='button' or local-name()='keygen']" # :nodoc:
|
|
31
|
+
|
|
23
32
|
attr_accessor :method, :action, :name
|
|
24
33
|
|
|
25
34
|
attr_reader :fields, :buttons, :file_uploads, :radiobuttons, :checkboxes
|
|
@@ -307,7 +316,7 @@ class Mechanize::Form
|
|
|
307
316
|
|
|
308
317
|
(fields + checkboxes).reject do |f|
|
|
309
318
|
f.node["disabled"] || f.node["name"] == ""
|
|
310
|
-
end.
|
|
319
|
+
end.each do |f|
|
|
311
320
|
case f
|
|
312
321
|
when Mechanize::Form::CheckBox
|
|
313
322
|
if f.checked
|
|
@@ -344,7 +353,7 @@ class Mechanize::Form
|
|
|
344
353
|
successful_controls << b
|
|
345
354
|
}
|
|
346
355
|
|
|
347
|
-
successful_controls.
|
|
356
|
+
order_successful_controls(successful_controls).each do |ctrl|
|
|
348
357
|
qval = proc_query(ctrl)
|
|
349
358
|
query.push(*qval)
|
|
350
359
|
end
|
|
@@ -352,6 +361,16 @@ class Mechanize::Form
|
|
|
352
361
|
query
|
|
353
362
|
end
|
|
354
363
|
|
|
364
|
+
# Orders parsed controls by the position parse recorded from CONTROLS_XPATH,
|
|
365
|
+
# which is document order. Sorting them with Field#<=> would compare
|
|
366
|
+
# Nokogiri nodes, which takes at least quadratic time. Controls added after
|
|
367
|
+
# parsing go last.
|
|
368
|
+
def order_successful_controls(controls)
|
|
369
|
+
parsed, added = controls.partition { |control| @control_positions.key?(control) }
|
|
370
|
+
parsed.sort_by { |control| @control_positions[control] } + added.sort
|
|
371
|
+
end
|
|
372
|
+
private :order_successful_controls
|
|
373
|
+
|
|
355
374
|
# This method adds an index to all fields that have Hash nodes. This
|
|
356
375
|
# enables field sorting to maintain order.
|
|
357
376
|
def save_hash_field_order
|
|
@@ -582,66 +601,72 @@ class Mechanize::Form
|
|
|
582
601
|
@file_uploads = []
|
|
583
602
|
@radiobuttons = []
|
|
584
603
|
@checkboxes = []
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
when '
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
604
|
+
@control_positions = {}.compare_by_identity
|
|
605
|
+
|
|
606
|
+
# The collections list input controls before the other tags, so collect
|
|
607
|
+
# the other tags here and append them after the loop.
|
|
608
|
+
textareas = []
|
|
609
|
+
selects = []
|
|
610
|
+
keygens = []
|
|
611
|
+
button_tags = []
|
|
612
|
+
|
|
613
|
+
@node.search(CONTROLS_XPATH).each do |node|
|
|
614
|
+
case node.name
|
|
615
|
+
when 'input'
|
|
616
|
+
type = (node['type'] || 'text').downcase
|
|
617
|
+
name = node['name']
|
|
618
|
+
next if name.nil? && !%w[submit button image].include?(type)
|
|
619
|
+
case type
|
|
620
|
+
when 'radio'
|
|
621
|
+
add_control @radiobuttons, RadioButton.new(node, self)
|
|
622
|
+
when 'checkbox'
|
|
623
|
+
add_control @checkboxes, CheckBox.new(node, self)
|
|
624
|
+
when 'file'
|
|
625
|
+
add_control @file_uploads, FileUpload.new(node, nil)
|
|
626
|
+
when 'submit'
|
|
627
|
+
add_control @buttons, Submit.new(node)
|
|
628
|
+
when 'button'
|
|
629
|
+
add_control @buttons, Button.new(node)
|
|
630
|
+
when 'reset'
|
|
631
|
+
add_control @buttons, Reset.new(node)
|
|
632
|
+
when 'image'
|
|
633
|
+
add_control @buttons, ImageButton.new(node)
|
|
634
|
+
when 'hidden'
|
|
635
|
+
add_control @fields, Hidden.new(node, node['value'] || '')
|
|
636
|
+
when 'text'
|
|
637
|
+
add_control @fields, Text.new(node, node['value'] || '')
|
|
638
|
+
when 'textarea'
|
|
639
|
+
add_control @fields, Textarea.new(node, node['value'] || '')
|
|
640
|
+
else
|
|
641
|
+
add_control @fields, Field.new(node, node['value'] || '')
|
|
642
|
+
end
|
|
610
643
|
when 'textarea'
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
@fields << MultiSelectList.new(node)
|
|
628
|
-
else
|
|
629
|
-
@fields << SelectList.new(node)
|
|
644
|
+
next unless node['name']
|
|
645
|
+
add_control textareas, Textarea.new(node, node.inner_text)
|
|
646
|
+
when 'select'
|
|
647
|
+
next unless node['name']
|
|
648
|
+
if node.has_attribute? 'multiple'
|
|
649
|
+
add_control selects, MultiSelectList.new(node)
|
|
650
|
+
else
|
|
651
|
+
add_control selects, SelectList.new(node)
|
|
652
|
+
end
|
|
653
|
+
when 'button'
|
|
654
|
+
# FIXME: what can I do with the reset buttons?
|
|
655
|
+
type = (node['type'] || 'submit').downcase
|
|
656
|
+
next if type == 'reset'
|
|
657
|
+
add_control button_tags, Button.new(node)
|
|
658
|
+
when 'keygen'
|
|
659
|
+
add_control keygens, Keygen.new(node, node['value'] || '')
|
|
630
660
|
end
|
|
631
661
|
end
|
|
632
662
|
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
type = (node['type'] || 'submit').downcase
|
|
637
|
-
next if type == 'reset'
|
|
638
|
-
@buttons << Button.new(node)
|
|
639
|
-
end
|
|
663
|
+
@fields.concat(textareas, selects, keygens)
|
|
664
|
+
@buttons.concat(button_tags)
|
|
665
|
+
end
|
|
640
666
|
|
|
641
|
-
|
|
642
|
-
@
|
|
643
|
-
|
|
644
|
-
end
|
|
667
|
+
def add_control(list, control)
|
|
668
|
+
@control_positions[control] = @control_positions.size
|
|
669
|
+
list << control
|
|
645
670
|
end
|
|
646
671
|
|
|
647
672
|
def rand_string(len = 10)
|
data/lib/mechanize/parser.rb
CHANGED
|
@@ -108,10 +108,10 @@ module Mechanize::Parser
|
|
|
108
108
|
handled = false
|
|
109
109
|
|
|
110
110
|
if @uri then
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
uri_path = remove_dot_segments @uri.path
|
|
112
|
+
uri_path += 'index.html' if uri_path.end_with? '/'
|
|
113
113
|
|
|
114
|
-
path =
|
|
114
|
+
path = uri_path.split(/\//)
|
|
115
115
|
filename = path.pop || 'index.html'
|
|
116
116
|
else
|
|
117
117
|
path = []
|
|
@@ -163,6 +163,36 @@ module Mechanize::Parser
|
|
|
163
163
|
@response
|
|
164
164
|
end
|
|
165
165
|
|
|
166
|
+
##
|
|
167
|
+
# Resolves "." and ".." segments in the absolute +path+ as RFC 3986 section
|
|
168
|
+
# 5.2.4 does, without reparsing it as a URI.
|
|
169
|
+
|
|
170
|
+
def remove_dot_segments path
|
|
171
|
+
segments = path.split '/', -1
|
|
172
|
+
|
|
173
|
+
resolved = segments.each_with_object [] do |segment, result|
|
|
174
|
+
case segment
|
|
175
|
+
when '.' then next
|
|
176
|
+
when '..' then result.pop unless result == ['']
|
|
177
|
+
else result << segment
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
resolved << '' if ['.', '..'].include? segments.last
|
|
182
|
+
resolved.join '/'
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
##
|
|
186
|
+
# Raises Mechanize::Error unless +path+ is inside +directory+.
|
|
187
|
+
|
|
188
|
+
def ensure_within directory, path
|
|
189
|
+
directory = File.join File.expand_path(directory), ''
|
|
190
|
+
|
|
191
|
+
return if File.expand_path(path).start_with? directory
|
|
192
|
+
|
|
193
|
+
raise Mechanize::Error, "refusing to save #{path} outside #{directory}"
|
|
194
|
+
end
|
|
195
|
+
|
|
166
196
|
##
|
|
167
197
|
# Finds a free filename based on +filename+, but is not race-free
|
|
168
198
|
|
data/lib/mechanize/test_case.rb
CHANGED
|
@@ -262,15 +262,8 @@ class Net::HTTP # :nodoc:
|
|
|
262
262
|
response['Content-Type'] ||= 'text/html'
|
|
263
263
|
response['Content-Length'] = res['Content-Length'] || res.body.length.to_s
|
|
264
264
|
|
|
265
|
-
|
|
266
|
-
response.instance_variable_set :@socket,
|
|
267
|
-
def io.read clen, dest = nil, _ = nil
|
|
268
|
-
if dest then
|
|
269
|
-
dest << super(clen)
|
|
270
|
-
else
|
|
271
|
-
super clen
|
|
272
|
-
end
|
|
273
|
-
end
|
|
265
|
+
socket = Net::BufferedIO.new(StringIO.new(res.body))
|
|
266
|
+
response.instance_variable_set :@socket, socket
|
|
274
267
|
|
|
275
268
|
body_exist = req.response_body_permitted? &&
|
|
276
269
|
response_klass.body_permitted?
|
data/lib/mechanize/version.rb
CHANGED
data/lib/mechanize.rb
CHANGED
|
@@ -130,18 +130,18 @@ class Mechanize
|
|
|
130
130
|
AGENT_ALIASES = {
|
|
131
131
|
'Mechanize' => "Mechanize/#{VERSION} Ruby/#{ruby_version} (http://github.com/sparklemotion/mechanize/)",
|
|
132
132
|
|
|
133
|
-
'Linux Firefox' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:
|
|
133
|
+
'Linux Firefox' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:160.0) Gecko/20100101 Firefox/160.0',
|
|
134
134
|
'Linux Konqueror' => 'Mozilla/5.0 (compatible; Konqueror/3; Linux)',
|
|
135
135
|
'Linux Mozilla' => 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624',
|
|
136
136
|
|
|
137
|
-
'Mac Firefox' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X
|
|
137
|
+
'Mac Firefox' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 15.8; rv:160.0) Gecko/20100101 Firefox/160.0',
|
|
138
138
|
'Mac Mozilla' => 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.4a) Gecko/20030401',
|
|
139
139
|
'Mac Safari 4' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; de-at) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10',
|
|
140
|
-
'Mac Safari' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X
|
|
140
|
+
'Mac Safari' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 15_8_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/27.0 Safari/605.1.15',
|
|
141
141
|
|
|
142
|
-
'Windows Chrome' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
|
|
143
|
-
'Windows Edge' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
|
|
144
|
-
'Windows Firefox' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:
|
|
142
|
+
'Windows Chrome' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/157.0.0.0 Safari/537.36',
|
|
143
|
+
'Windows Edge' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/157.0.0.0 Safari/537.36 Edg/157.0.4341.60',
|
|
144
|
+
'Windows Firefox' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:160.0) Gecko/20100101 Firefox/160.0',
|
|
145
145
|
'Windows IE 6' => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)',
|
|
146
146
|
'Windows IE 7' => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)',
|
|
147
147
|
'Windows IE 8' => 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727)',
|
|
@@ -150,9 +150,9 @@ class Mechanize
|
|
|
150
150
|
'Windows IE 11' => 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko',
|
|
151
151
|
'Windows Mozilla' => 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030516 Mozilla Firebird/0.6',
|
|
152
152
|
|
|
153
|
-
'Android' => 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
|
|
154
|
-
'iPad' => 'Mozilla/5.0 (iPad; CPU OS
|
|
155
|
-
'iPhone' => 'Mozilla/5.0 (iPhone; CPU iPhone OS
|
|
153
|
+
'Android' => 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/157.0.8103.80 Mobile Safari/537.36',
|
|
154
|
+
'iPad' => 'Mozilla/5.0 (iPad; CPU OS 18_7_12 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/27.0 Mobile/15E148 Safari/604.1',
|
|
155
|
+
'iPhone' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_7_12 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/27.0 Mobile/15E148 Safari/604.1',
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
AGENT_ALIASES.default_proc = proc { |hash, key|
|
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.14.
|
|
4
|
+
version: 2.14.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eric Hodel
|
|
@@ -238,27 +238,12 @@ extra_rdoc_files:
|
|
|
238
238
|
- README.md
|
|
239
239
|
- SECURITY.md
|
|
240
240
|
files:
|
|
241
|
-
- ".autotest"
|
|
242
|
-
- ".github/dependabot.yml"
|
|
243
|
-
- ".github/workflows/ci.yml"
|
|
244
|
-
- ".github/workflows/upstream.yml"
|
|
245
|
-
- ".gitignore"
|
|
246
|
-
- ".yardopts"
|
|
247
241
|
- CHANGELOG.md
|
|
248
242
|
- EXAMPLES.rdoc
|
|
249
243
|
- GUIDE.rdoc
|
|
250
|
-
- Gemfile
|
|
251
244
|
- LICENSE.txt
|
|
252
245
|
- README.md
|
|
253
|
-
- Rakefile
|
|
254
246
|
- SECURITY.md
|
|
255
|
-
- examples/flickr_upload.rb
|
|
256
|
-
- examples/latest_user_agents.rb
|
|
257
|
-
- examples/mech-dump.rb
|
|
258
|
-
- examples/proxy_req.rb
|
|
259
|
-
- examples/rubygems.rb
|
|
260
|
-
- examples/spider.rb
|
|
261
|
-
- examples/wikipedia_links_to_philosophy.rb
|
|
262
247
|
- lib/mechanize.rb
|
|
263
248
|
- lib/mechanize/chunked_termination_error.rb
|
|
264
249
|
- lib/mechanize/content_type_error.rb
|
|
@@ -349,12 +334,6 @@ files:
|
|
|
349
334
|
- lib/mechanize/util.rb
|
|
350
335
|
- lib/mechanize/version.rb
|
|
351
336
|
- lib/mechanize/xml_file.rb
|
|
352
|
-
- mechanize.gemspec
|
|
353
|
-
- test/data/htpasswd
|
|
354
|
-
- test/data/server.crt
|
|
355
|
-
- test/data/server.csr
|
|
356
|
-
- test/data/server.key
|
|
357
|
-
- test/data/server.pem
|
|
358
337
|
- test/htdocs/alt_text.html
|
|
359
338
|
- test/htdocs/bad_form_test.html
|
|
360
339
|
- test/htdocs/button.jpg
|
|
@@ -402,54 +381,6 @@ files:
|
|
|
402
381
|
- test/htdocs/tc_textarea.html
|
|
403
382
|
- test/htdocs/test_click.html
|
|
404
383
|
- test/htdocs/unusual______.html
|
|
405
|
-
- test/test_mechanize.rb
|
|
406
|
-
- test/test_mechanize_cookie.rb
|
|
407
|
-
- test/test_mechanize_cookie_jar.rb
|
|
408
|
-
- test/test_mechanize_directory_saver.rb
|
|
409
|
-
- test/test_mechanize_download.rb
|
|
410
|
-
- test/test_mechanize_element_not_found_error.rb
|
|
411
|
-
- test/test_mechanize_file.rb
|
|
412
|
-
- test/test_mechanize_file_connection.rb
|
|
413
|
-
- test/test_mechanize_file_request.rb
|
|
414
|
-
- test/test_mechanize_file_response.rb
|
|
415
|
-
- test/test_mechanize_file_saver.rb
|
|
416
|
-
- test/test_mechanize_form.rb
|
|
417
|
-
- test/test_mechanize_form_check_box.rb
|
|
418
|
-
- test/test_mechanize_form_encoding.rb
|
|
419
|
-
- test/test_mechanize_form_field.rb
|
|
420
|
-
- test/test_mechanize_form_file_upload.rb
|
|
421
|
-
- test/test_mechanize_form_image_button.rb
|
|
422
|
-
- test/test_mechanize_form_keygen.rb
|
|
423
|
-
- test/test_mechanize_form_multi_select_list.rb
|
|
424
|
-
- test/test_mechanize_form_option.rb
|
|
425
|
-
- test/test_mechanize_form_radio_button.rb
|
|
426
|
-
- test/test_mechanize_form_select_list.rb
|
|
427
|
-
- test/test_mechanize_form_textarea.rb
|
|
428
|
-
- test/test_mechanize_headers.rb
|
|
429
|
-
- test/test_mechanize_history.rb
|
|
430
|
-
- test/test_mechanize_http_agent.rb
|
|
431
|
-
- test/test_mechanize_http_auth_challenge.rb
|
|
432
|
-
- test/test_mechanize_http_auth_realm.rb
|
|
433
|
-
- test/test_mechanize_http_auth_store.rb
|
|
434
|
-
- test/test_mechanize_http_content_disposition_parser.rb
|
|
435
|
-
- test/test_mechanize_http_www_authenticate_parser.rb
|
|
436
|
-
- test/test_mechanize_image.rb
|
|
437
|
-
- test/test_mechanize_link.rb
|
|
438
|
-
- test/test_mechanize_page.rb
|
|
439
|
-
- test/test_mechanize_page_encoding.rb
|
|
440
|
-
- test/test_mechanize_page_frame.rb
|
|
441
|
-
- test/test_mechanize_page_image.rb
|
|
442
|
-
- test/test_mechanize_page_link.rb
|
|
443
|
-
- test/test_mechanize_page_meta_refresh.rb
|
|
444
|
-
- test/test_mechanize_parser.rb
|
|
445
|
-
- test/test_mechanize_pluggable_parser.rb
|
|
446
|
-
- test/test_mechanize_redirect_limit_reached_error.rb
|
|
447
|
-
- test/test_mechanize_redirect_not_get_or_head_error.rb
|
|
448
|
-
- test/test_mechanize_response_read_error.rb
|
|
449
|
-
- test/test_mechanize_subclass.rb
|
|
450
|
-
- test/test_mechanize_util.rb
|
|
451
|
-
- test/test_mechanize_xml_file.rb
|
|
452
|
-
- test/test_multi_select.rb
|
|
453
384
|
homepage: https://github.com/sparklemotion/mechanize
|
|
454
385
|
licenses:
|
|
455
386
|
- MIT
|
|
@@ -476,107 +407,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
476
407
|
- !ruby/object:Gem::Version
|
|
477
408
|
version: '0'
|
|
478
409
|
requirements: []
|
|
479
|
-
rubygems_version: 4.0.
|
|
410
|
+
rubygems_version: 4.0.20
|
|
480
411
|
specification_version: 4
|
|
481
412
|
summary: The Mechanize library is used for automating interaction with websites
|
|
482
|
-
test_files:
|
|
483
|
-
- test/data/htpasswd
|
|
484
|
-
- test/data/server.crt
|
|
485
|
-
- test/data/server.csr
|
|
486
|
-
- test/data/server.key
|
|
487
|
-
- test/data/server.pem
|
|
488
|
-
- test/htdocs/alt_text.html
|
|
489
|
-
- test/htdocs/bad_form_test.html
|
|
490
|
-
- test/htdocs/button.jpg
|
|
491
|
-
- test/htdocs/canonical_uri.html
|
|
492
|
-
- test/htdocs/dir with spaces/foo.html
|
|
493
|
-
- test/htdocs/empty_form.html
|
|
494
|
-
- test/htdocs/file_upload.html
|
|
495
|
-
- test/htdocs/find_link.html
|
|
496
|
-
- test/htdocs/form_multi_select.html
|
|
497
|
-
- test/htdocs/form_multival.html
|
|
498
|
-
- test/htdocs/form_no_action.html
|
|
499
|
-
- test/htdocs/form_no_input_name.html
|
|
500
|
-
- test/htdocs/form_order_test.html
|
|
501
|
-
- test/htdocs/form_select.html
|
|
502
|
-
- test/htdocs/form_set_fields.html
|
|
503
|
-
- test/htdocs/form_test.html
|
|
504
|
-
- test/htdocs/frame_referer_test.html
|
|
505
|
-
- test/htdocs/frame_test.html
|
|
506
|
-
- test/htdocs/google.html
|
|
507
|
-
- test/htdocs/index.html
|
|
508
|
-
- test/htdocs/link with space.html
|
|
509
|
-
- test/htdocs/meta_cookie.html
|
|
510
|
-
- test/htdocs/no_title_test.html
|
|
511
|
-
- test/htdocs/noindex.html
|
|
512
|
-
- test/htdocs/rails_3_encoding_hack_form_test.html
|
|
513
|
-
- test/htdocs/relative/tc_relative_links.html
|
|
514
|
-
- test/htdocs/robots.html
|
|
515
|
-
- test/htdocs/tc_bad_charset.html
|
|
516
|
-
- test/htdocs/tc_bad_links.html
|
|
517
|
-
- test/htdocs/tc_base_link.html
|
|
518
|
-
- test/htdocs/tc_blank_form.html
|
|
519
|
-
- test/htdocs/tc_charset.html
|
|
520
|
-
- test/htdocs/tc_checkboxes.html
|
|
521
|
-
- test/htdocs/tc_encoded_links.html
|
|
522
|
-
- test/htdocs/tc_field_precedence.html
|
|
523
|
-
- test/htdocs/tc_follow_meta.html
|
|
524
|
-
- test/htdocs/tc_follow_meta_loop_1.html
|
|
525
|
-
- test/htdocs/tc_follow_meta_loop_2.html
|
|
526
|
-
- test/htdocs/tc_form_action.html
|
|
527
|
-
- test/htdocs/tc_links.html
|
|
528
|
-
- test/htdocs/tc_meta_in_body.html
|
|
529
|
-
- test/htdocs/tc_pretty_print.html
|
|
530
|
-
- test/htdocs/tc_referer.html
|
|
531
|
-
- test/htdocs/tc_relative_links.html
|
|
532
|
-
- test/htdocs/tc_textarea.html
|
|
533
|
-
- test/htdocs/test_click.html
|
|
534
|
-
- test/htdocs/unusual______.html
|
|
535
|
-
- test/test_mechanize.rb
|
|
536
|
-
- test/test_mechanize_cookie.rb
|
|
537
|
-
- test/test_mechanize_cookie_jar.rb
|
|
538
|
-
- test/test_mechanize_directory_saver.rb
|
|
539
|
-
- test/test_mechanize_download.rb
|
|
540
|
-
- test/test_mechanize_element_not_found_error.rb
|
|
541
|
-
- test/test_mechanize_file.rb
|
|
542
|
-
- test/test_mechanize_file_connection.rb
|
|
543
|
-
- test/test_mechanize_file_request.rb
|
|
544
|
-
- test/test_mechanize_file_response.rb
|
|
545
|
-
- test/test_mechanize_file_saver.rb
|
|
546
|
-
- test/test_mechanize_form.rb
|
|
547
|
-
- test/test_mechanize_form_check_box.rb
|
|
548
|
-
- test/test_mechanize_form_encoding.rb
|
|
549
|
-
- test/test_mechanize_form_field.rb
|
|
550
|
-
- test/test_mechanize_form_file_upload.rb
|
|
551
|
-
- test/test_mechanize_form_image_button.rb
|
|
552
|
-
- test/test_mechanize_form_keygen.rb
|
|
553
|
-
- test/test_mechanize_form_multi_select_list.rb
|
|
554
|
-
- test/test_mechanize_form_option.rb
|
|
555
|
-
- test/test_mechanize_form_radio_button.rb
|
|
556
|
-
- test/test_mechanize_form_select_list.rb
|
|
557
|
-
- test/test_mechanize_form_textarea.rb
|
|
558
|
-
- test/test_mechanize_headers.rb
|
|
559
|
-
- test/test_mechanize_history.rb
|
|
560
|
-
- test/test_mechanize_http_agent.rb
|
|
561
|
-
- test/test_mechanize_http_auth_challenge.rb
|
|
562
|
-
- test/test_mechanize_http_auth_realm.rb
|
|
563
|
-
- test/test_mechanize_http_auth_store.rb
|
|
564
|
-
- test/test_mechanize_http_content_disposition_parser.rb
|
|
565
|
-
- test/test_mechanize_http_www_authenticate_parser.rb
|
|
566
|
-
- test/test_mechanize_image.rb
|
|
567
|
-
- test/test_mechanize_link.rb
|
|
568
|
-
- test/test_mechanize_page.rb
|
|
569
|
-
- test/test_mechanize_page_encoding.rb
|
|
570
|
-
- test/test_mechanize_page_frame.rb
|
|
571
|
-
- test/test_mechanize_page_image.rb
|
|
572
|
-
- test/test_mechanize_page_link.rb
|
|
573
|
-
- test/test_mechanize_page_meta_refresh.rb
|
|
574
|
-
- test/test_mechanize_parser.rb
|
|
575
|
-
- test/test_mechanize_pluggable_parser.rb
|
|
576
|
-
- test/test_mechanize_redirect_limit_reached_error.rb
|
|
577
|
-
- test/test_mechanize_redirect_not_get_or_head_error.rb
|
|
578
|
-
- test/test_mechanize_response_read_error.rb
|
|
579
|
-
- test/test_mechanize_subclass.rb
|
|
580
|
-
- test/test_mechanize_util.rb
|
|
581
|
-
- test/test_mechanize_xml_file.rb
|
|
582
|
-
- test/test_multi_select.rb
|
|
413
|
+
test_files: []
|
data/.autotest
DELETED
data/.github/dependabot.yml
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
-
# package ecosystems to update and where the package manifests are located.
|
|
3
|
-
# Please see the documentation for all configuration options:
|
|
4
|
-
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
5
|
-
|
|
6
|
-
version: 2
|
|
7
|
-
updates:
|
|
8
|
-
- package-ecosystem: "bundler"
|
|
9
|
-
directory: "/"
|
|
10
|
-
schedule:
|
|
11
|
-
interval: "weekly"
|
data/.github/workflows/ci.yml
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
name: "ci"
|
|
2
|
-
|
|
3
|
-
concurrency:
|
|
4
|
-
group: "${{github.workflow}}-${{github.ref}}"
|
|
5
|
-
cancel-in-progress: true
|
|
6
|
-
|
|
7
|
-
on:
|
|
8
|
-
workflow_dispatch:
|
|
9
|
-
schedule:
|
|
10
|
-
- cron: "0 8 * * 5" # At 08:00 on Friday # https://crontab.guru/#0_8_*_*_5
|
|
11
|
-
push:
|
|
12
|
-
branches:
|
|
13
|
-
- main
|
|
14
|
-
pull_request:
|
|
15
|
-
types: [opened, synchronize]
|
|
16
|
-
branches:
|
|
17
|
-
- main
|
|
18
|
-
|
|
19
|
-
jobs:
|
|
20
|
-
rubocop:
|
|
21
|
-
runs-on: ubuntu-latest
|
|
22
|
-
steps:
|
|
23
|
-
- uses: actions/checkout@v4
|
|
24
|
-
- uses: ruby/setup-ruby@v1
|
|
25
|
-
with:
|
|
26
|
-
ruby-version: "4.0"
|
|
27
|
-
bundler-cache: true
|
|
28
|
-
- run: bundle exec rake rubocop
|
|
29
|
-
|
|
30
|
-
test:
|
|
31
|
-
needs: ["rubocop"]
|
|
32
|
-
strategy:
|
|
33
|
-
fail-fast: false
|
|
34
|
-
matrix:
|
|
35
|
-
ruby-version: ["2.6", "2.7", "3.0", "3.1", "3.2", "3.3", "3.4", "4.0"]
|
|
36
|
-
runs-on: ubuntu-latest
|
|
37
|
-
steps:
|
|
38
|
-
- uses: actions/checkout@v4
|
|
39
|
-
- uses: ruby/setup-ruby@v1
|
|
40
|
-
with:
|
|
41
|
-
ruby-version: ${{matrix.ruby-version}}
|
|
42
|
-
bundler-cache: true
|
|
43
|
-
- run: bundle exec rake test
|