Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
e9deb2b
updates Linux Firefox user-agent to rev94
ncs1 Nov 9, 2021
b898f47
Merge pull request #587 from ncs1/update_linux_firefox_ua
flavorjones Nov 11, 2021
4a0dfe5
version bump to v2.8.3
flavorjones Nov 11, 2021
1c099a6
use safe_load when using Psych >= 3.1
flavorjones Jan 17, 2022
ec9af73
Merge pull request #589 from sparklemotion/flavorjones-use-psych-safe…
flavorjones Jan 17, 2022
8302ec5
ci: update to cover Ruby 3.1
flavorjones Jan 17, 2022
c8b9d79
Merge pull request #588 from sparklemotion/flavorjones-update-ci-to-r…
flavorjones Jan 17, 2022
70ebc34
version bump to v2.8.4
flavorjones Jan 17, 2022
907c778
fix: clear credentials when redirecting to a different port
flavorjones Jun 6, 2022
c7fe699
Merge pull request #600 from sparklemotion/flavorjones-redirect-headers
flavorjones Jun 9, 2022
c1091fd
version bump to v2.8.5
flavorjones Jun 9, 2022
ab33104
ci: include ruby 3.2
flavorjones Feb 7, 2023
1cf35a5
ci: run CI in a cron job and cancel concurrent jobs
flavorjones Feb 7, 2023
802ce5c
test: skip NTLM test if openssl doesn't support MD4
flavorjones Feb 7, 2023
23f8a16
test: simplify jruby skips
flavorjones Feb 7, 2023
848084a
ci: pin jruby to 9.3 for now
flavorjones Feb 7, 2023
5c2b2b8
Merge pull request #606 from sparklemotion/flavorjones-update-ci-with…
flavorjones Feb 7, 2023
84ca53e
example: fix wikipedia script
flavorjones Feb 7, 2023
5dd0b84
Merge branch 'flavorjones-fix-wikipedia-script'
flavorjones Feb 7, 2023
427f9be
ci: update to jruby 9.4
flavorjones Mar 5, 2023
cb9da39
ci: use modern bundler
flavorjones Mar 5, 2023
70db881
Merge pull request #607 from sparklemotion/flavorjones-fix-ci-ruby-2.5
flavorjones Mar 6, 2023
3584eeb
drop Ruby 2.5 support
flavorjones Mar 14, 2023
4c8d3d2
Merge pull request #608 from sparklemotion/flavorjones-another-ruby25…
flavorjones Mar 15, 2023
96a28e7
fix: stop force_encoding the page body
Apr 6, 2023
18ca167
Merge pull request #610 from sparklemotion/flavorjones-drop-force-enc…
flavorjones Apr 7, 2023
cfa06d2
doc: update CHANGELOG
Apr 7, 2023
77ab71c
ci: update to actions/checkout@v3
Apr 7, 2023
b8f52c0
Merge pull request #611 from sparklemotion/flavorjones-update-ci-actions
flavorjones Apr 7, 2023
cf041d7
version bump to v2.9.0
Apr 7, 2023
78791c5
add example to fetch latest user agents
takatea Apr 14, 2023
96d21aa
update user agent strings for agent aliases
takatea Apr 14, 2023
18b7efd
doc: update docstring for AGENT_ALIASES and CHANGELOG
flavorjones Apr 15, 2023
4ab81ef
Merge pull request #612 from takatea/add-example-to-fetch-latest-user…
flavorjones Apr 15, 2023
59cc064
version bump to v2.9.1
flavorjones Apr 17, 2023
762df0c
test: work around libxml2 encoding changes
flavorjones Jun 7, 2023
74574f9
Merge pull request #614 from sparklemotion/613-update-tests-for-libxm…
flavorjones Jun 7, 2023
0ba09f4
test: work around libxml2 encoding changes
flavorjones Aug 11, 2023
4c82b11
Merge pull request #622 from sparklemotion/613-more-changes
flavorjones Aug 11, 2023
37785c0
ci: test_mechanize_page_link requires nokogiri before using it
flavorjones Sep 16, 2023
119d13e
Merge pull request #623 from sparklemotion/flavorjones-fix-require-order
flavorjones Sep 16, 2023
c037db6
ci: enable manual workflow
flavorjones Dec 13, 2023
13c8c39
dep: remove mutex_m which is unused since 4d074f4d (2010)
flavorjones Dec 13, 2023
e6a94fd
Merge pull request #629 from sparklemotion/flavorjones-ruby-3.3-gem-w…
flavorjones Dec 13, 2023
245cc78
ci: add ruby 3.3 to the matrix
flavorjones Dec 29, 2023
46482f1
test: accept "UTF-8" as an encoding alias for "UTF8"
flavorjones Dec 29, 2023
d52c39a
Merge pull request #630 from sparklemotion/flavorjones-update-ci-ruby-33
flavorjones Dec 29, 2023
b3e9a0d
various: fix miscellaneous typos
p-linnane Jan 12, 2024
8f0bfa0
update example of latest_user_agents
takatea Jan 13, 2024
baae66d
feat: output ordered user agents
takatea Jan 13, 2024
32c74ee
update user agent strings for agent aliases
takatea Jan 13, 2024
34ccbd6
doc: update docstring for AGENT_ALIASES and remove todo comment
takatea Jan 13, 2024
03540ab
Merge pull request #631 from p-linnane/fix-various-typos
flavorjones Jan 13, 2024
f75af0a
Merge pull request #632 from takatea/update-example-latest_user_agents
flavorjones Jan 15, 2024
553f6c1
version bump to v2.9.2
flavorjones Jan 15, 2024
9f85f2d
dep: ruby 3.4 unbundled gems
flavorjones Jan 22, 2024
acb36b8
ci: add truffleruby (stable) and jruby-head
flavorjones Jan 22, 2024
460e70d
Merge pull request #634 from sparklemotion/flavorjones-dep-nkf
flavorjones Jan 22, 2024
8c47e35
version bump to v2.10.0
flavorjones Jan 22, 2024
9de5c1d
test: backfill coverage on Cookie#set_domain deprecation message
flavorjones Feb 21, 2024
73b8a7e
prefer caller_locations and Thread::Backtrace::Location methods
flavorjones Feb 21, 2024
2d4b1af
Merge pull request #638 from sparklemotion/flavorjones-prefer-caller-…
flavorjones Feb 21, 2024
4a11085
ci: skeleton upstream.yml file
flavorjones Mar 23, 2024
f89dc84
ci: rename pipeline, update versions, drop windows and macos
flavorjones Mar 23, 2024
3cff941
ci: extract upstream.yml pipeline
flavorjones Mar 23, 2024
9e72346
ci: add upstream nokogiri integration test
flavorjones Mar 23, 2024
d353494
Merge pull request #639 from sparklemotion/flavorjones-refactor-ci
flavorjones Mar 23, 2024
608f729
test: update tests to use frozen string literals
flavorjones Mar 24, 2024
3509024
Merge pull request #640 from sparklemotion/flavorjones-frozen-string-…
flavorjones Mar 24, 2024
faba4a1
Update README.md
izumitomo Apr 18, 2024
7834210
Merge pull request #643 from izumitomo/fix-README
flavorjones Apr 18, 2024
11d668a
fix: correctly recognize encoding errors in libxml >= 2.12.0
flavorjones Jun 12, 2024
c38962c
Merge pull request #644 from sparklemotion/flavorjones-fix-bad-encodi…
flavorjones Jun 12, 2024
b0738a4
version bump to v2.10.1
flavorjones Jun 12, 2024
6e70867
tidy: do not send the deprecated `accept-charset` header
flavorjones Jul 18, 2024
f56af09
Merge pull request #648 from sparklemotion/flavorjones-647-remove-dep…
flavorjones Jul 18, 2024
90a412b
version bump to v2.11.0
flavorjones Jul 18, 2024
4ebfdb7
Handle Brotli compression
weshatheleopard Jul 28, 2024
cf13211
tidy: small edits to content_encoding_brotli
flavorjones Jul 28, 2024
33bb535
handle brotli-deflation errors
flavorjones Jul 28, 2024
35c2851
brotli is an optional dependency
flavorjones Jul 28, 2024
48ddd3c
doc: update CHANGELOG and mark brotli support as experimental
flavorjones Jul 28, 2024
1636348
Merge pull request #650 from weshatheleopard/main
flavorjones Jul 29, 2024
dbfa966
version bump to v2.12.0
flavorjones Jul 29, 2024
e9460cf
test: don't use minitest/pride
flavorjones Aug 14, 2024
752e4d2
Merge pull request #651 from sparklemotion/flavorjones-pride-is-broken
flavorjones Aug 14, 2024
1956295
Add Zstd support (optional dependency, just like Brotli)
adrianodennanni Aug 20, 2024
3bace72
Merge pull request #652 from adrianodennanni/main
flavorjones Aug 21, 2024
4724780
version bump to v2.12.1
flavorjones Aug 21, 2024
1c2fc28
fix: mime type string deprecation
avk Oct 2, 2024
5b74852
dep: bump the min version of mime-types
flavorjones Oct 2, 2024
2ae412a
Merge pull request #655 from avk/main
flavorjones Oct 2, 2024
7f140c2
version bump to v2.12.2
flavorjones Oct 2, 2024
a7f9461
ci: I'm tired of fighting to keep jruby and truffleruby green
flavorjones Dec 27, 2024
c3cd522
Merge pull request #659 from sparklemotion/flavorjones-ci-drop-jruby-…
flavorjones Dec 27, 2024
9b3b6e2
Fix frozen string warning for Ruby 3.4
simpl1g Jan 2, 2025
1cf48f6
doc: update CHANGELOG
flavorjones Jan 2, 2025
e9bc524
Merge pull request #661 from simpl1g/fix-frozen-string-warning-for-3-4
flavorjones Jan 2, 2025
be2de52
quash Ruby 3.4 URI::Parser warnings
flavorjones Jan 2, 2025
e564d56
Merge pull request #662 from sparklemotion/flavorjones-ruby-34-warnings
flavorjones Jan 2, 2025
bbbed46
version bump to v2.13.0
flavorjones Jan 2, 2025
0b23841
ci: add ruby-head to the matrix
flavorjones Jan 2, 2025
22b9dd4
Support Net::HTTP::Persistent.write_timeout
maurycy Aug 8, 2021
588eee9
doc: update CHANGELOG
flavorjones Jan 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 11 additions & 21 deletions .github/workflows/ci-test.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: "ci"

concurrency:
group: "${{github.workflow}}-${{github.ref}}"
cancel-in-progress: true

on:
workflow_dispatch:
schedule:
- cron: "0 8 * * 5" # At 08:00 on Friday # https://crontab.guru/#0_8_*_*_5
push:
branches:
- main
Expand All @@ -13,10 +20,10 @@ jobs:
rubocop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0"
ruby-version: "3.3"
bundler-cache: true
- run: bundle exec rake rubocop

Expand All @@ -25,29 +32,12 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: ["2.5", "2.6", "2.7", "3.0", "jruby", "truffleruby-head"]

ruby-version: ["2.6", "2.7", "3.0", "3.1", "3.2", "3.3", "3.4", "head"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{matrix.ruby-version}}
bundler-cache: true
- run: bundle exec rake test

test-platform:
needs: ["rubocop"]
strategy:
fail-fast: false
matrix:
platform: ["windows-latest", "macos-latest"]

runs-on: ${{matrix.platform}}
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0"
bundler-cache: true
- run: bundle exec rake test
51 changes: 51 additions & 0 deletions .github/workflows/upstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "upstream"

concurrency:
group: "${{github.workflow}}-${{github.ref}}"
cancel-in-progress: true

on:
workflow_dispatch:
schedule:
- cron: "0 8 * * 5" # At 08:00 on Friday # https://crontab.guru/#0_8_*_*_5
push:
branches:
- main
pull_request:
types: [opened, synchronize]
branches:
- main
paths:
- .github/workflows/upstream.yml # this file

jobs:
test:
strategy:
fail-fast: false
matrix:
ruby-version: ["head"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{matrix.ruby-version}}
bundler-cache: true
- run: bundle exec rake test

upstream:
name: "upstream (${{matrix.name}})"
strategy:
fail-fast: false
matrix:
include:
- { name: "nokogiri", git: "https://github.com/sparklemotion/nokogiri" }
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with: { ruby-version: "3.4" }
- run: |
bundle add ${{matrix.name}} --git="${{matrix.git}}"
bundle show
- run: bundle exec rake test
105 changes: 96 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,92 @@
# Mechanize CHANGELOG

## next / unreleased

* `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


## 2.13.0 / 2025-01-02

* Quash frozen string warnings in Ruby 3.4. (#661) @simpl1g
* Quash URI::Parser warnings in Ruby 3.4. (#662) @flavorjones


## 2.12.2 / 2023-10-02

* Quash warnings from `Mime::Type.new` in `mime-types` v3.6.0. (#655) @avk


## 2.12.1 / 2024-08-21

* Introduce experimental support for handling Zstd-compressed responses (CRuby only). (#652) @adrianodennanni


## 2.12.0 / 2024-07-29

* Introduce experimental support for handling Brotli-compressed responses (CRuby only). (#650) @weshatheleopard


## 2.11.0 / 2024-07-18

* The `accept-charset` header is no longer sent. In early versions of Mechanize, circa 2007, this was a common header but now no modern browser sends it, and servers are instructed to ignore it. See #646 for an example of a server that is confused by its presence. (#647) @flavorjones


## 2.10.1 / 2024-06-12

* Improve page encoding error recovery on pages with broken encoding when used with libxml2 >= 2.12.0. (#644) @flavorjones


## 2.10.0 / 2024-01-22

* Add `nkf` and `base64` as explicit dependencies, since they are being unbundled in Ruby 3.4. (#634) @flavorjones


## 2.9.2 / 2024-01-15

* Correct spelling errors in documentation. (#631) @p-linnane
* Updated User-Agent strings to represent modern browser versions. (#632) @takatea


## 2.9.1 / 2023-04-17

### Update

* Updated User-Agent strings to represent modern browser versions. (#612) Thank you, @takatea!


## 2.9.0 / 2023-04-07

### Requirements

* Mechanize now requires Ruby 2.6 or newer.


### Improvement

* Mechanize can now parse frozen strings. (#610)


## 2.8.5 / 2022-06-09

### Security

Fixes low-severity CVE-2022-31033, "Authorization header leak on port redirect." See [GHSA-64qm-hrgp-pgr9](https://github.com/sparklemotion/mechanize/security/advisories/GHSA-64qm-hrgp-pgr9) for more details.


## 2.8.4 / 2022-01-17

### Fix

* `Mechanize::CookieJar#load` calls `Psych.safe_load` when using Psych >= 3.1


## 2.8.3 / 2021-11-11

### Update

* Update the "Linux Firefox" user agent string to rev94 (#587) Thank you, @ncs1!


## 2.8.2 / 2021-08-06

### Dependencies
Expand Down Expand Up @@ -69,7 +156,7 @@
* Fix element(s)_with(search: selector) methods not working for forms, form fields and frames. (#444)
* Improve the filename parser for the `Content-Disposition` header. (#496, #517)
* Accept `Content-Encoding: identity`. (#515)
* Mechanize::Page#title no longer picks a title in an embeded SVG/RDF element. (#503)
* Mechanize::Page#title no longer picks a title in an embedded SVG/RDF element. (#503)
* Make Mechanize::Form#has_field? boolean. (#501)

## 2.7.5
Expand Down Expand Up @@ -375,8 +462,8 @@
* When given multiple HTTP authentication options mechanize now picks the
strongest method.
* Improvements to HTTP authorization:
* mechanize raises Mechanize::UnathorizedError for 401 responses which is
a sublcass of Mechanize::ResponseCodeError.
* mechanize raises Mechanize::UnauthorizedError for 401 responses which is
a subclass of Mechanize::ResponseCodeError.
* Added support for NTLM authentication, but this has not been tested.
* Mechanize::Cookie.new accepts attributes in a hash.
* Mechanize::CookieJar#<<(cookie) (alias: add!) is added. Issue #139
Expand Down Expand Up @@ -467,7 +554,7 @@ Mechanize is now under the MIT license

* New Features

* Add header reference methods to Mechanize::File so that a reponse
* Add header reference methods to Mechanize::File so that a response
object gets compatible with Net::HTTPResponse.
* Mechanize#click accepts a regexp or string to click a button/link in the
current page. It works as expected when not passed a string or regexp.
Expand Down Expand Up @@ -692,7 +779,7 @@ Mechanize is now under the MIT license
http://d.hatena.ne.jp/kitamomonga/20080410/ruby_mechanize_percent_url_bug
* #21132 Not checking for EOF errors on redirect
* Fixed a weird gzipping error.
* #21233 Smarter multipart boundry. Thanks Todd Willey!
* #21233 Smarter multipart boundary. Thanks Todd Willey!
* #20097 Supporting meta tag cookies.

## 0.7.6
Expand Down Expand Up @@ -801,7 +888,7 @@ Mechanize is now under the MIT license
* [#9877] Moved last request time. Thanks Max Stepanov
* Added WWW::Mechanize::File#save
* Defaulting file name to URI or Content-Disposition
* Updating compatability with hpricot
* Updating compatibility with hpricot
* Added more unit tests

## 0.6.7
Expand All @@ -813,7 +900,7 @@ Mechanize is now under the MIT license

* Removing hpricot overrides
* Fixed a bug where alt text can be nil. Thanks Yannick!
* Unparseable expiration dates in cookies are now treated as session cookies
* Unparsable expiration dates in cookies are now treated as session cookies
* Caching connections
* Requests now default to keep alive
* [#9434] Fixed bug where html entities weren't decoded
Expand Down Expand Up @@ -879,7 +966,7 @@ Mechanize is now under the MIT license
* Added a method to Form called "submit". Now forms can be submitted by
calling a method on the form.
* Added a click method to links
* Added an REXML pluggable parser for backwards compatability. To use it,
* Added an REXML pluggable parser for backwards compatibility. To use it,
just do this:
agent.pluggable_parser.html = WWW::Mechanize::REXMLPage
* Fixed a bug with referrers by adding a page attribute to forms and links.
Expand Down Expand Up @@ -1006,7 +1093,7 @@ Mechanize is now under the MIT license

## 0.4.4

* Fixed error in method signature, basic_authetication is now basic_auth
* Fixed error in method signature, basic_authentication is now basic_auth
* Fixed bug with encoding names in file uploads (Big thanks to Alex Young)
* Added options to the select list

Expand Down
9 changes: 9 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
source "https://rubygems.org"

gemspec

gem "minitest", "~> 5.14"
gem "rake", "~> 13.0"
gem "rdoc", "~> 6.3"
gem "rubocop", "~> 1.12"
unless RUBY_PLATFORM == 'java'
gem 'brotli', '>= 0.5'
gem 'zstd-ruby', '~> 1.5'
end
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* https://www.rubydoc.info/gems/mechanize/
* https://github.com/sparklemotion/mechanize

[![Test suite](https://github.com/sparklemotion/mechanize/actions/workflows/ci-test.yml/badge.svg)](https://github.com/sparklemotion/mechanize/actions/workflows/ci-test.yml)
[![Test suite](https://github.com/sparklemotion/mechanize/actions/workflows/ci.yml/badge.svg)](https://github.com/sparklemotion/mechanize/actions/workflows/ci.yml)


## Description
Expand All @@ -13,7 +13,7 @@ The Mechanize library is used for automating interaction with websites. Mechaniz

## Dependencies

* Ruby >= 2.5
* Ruby >= 2.6
* Gems:
* `addressable`
* `domain_name`
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace "rubocop" do

desc "Run rubocop string literals check"
task :frozen_string_literals do
sh "rubocop lib --auto-correct-all --only Style/FrozenStringLiteralComment"
sh "rubocop lib test --auto-correct-all --only Style/FrozenStringLiteralComment"
end
end

Expand Down
Loading
Loading