Skip to content

Commit

Permalink
Merge pull request #648 from sparklemotion/flavorjones-647-remove-dep…
Browse files Browse the repository at this point in the history
…recated-headers

tidy: do not send the deprecated `accept-charset` header
  • Loading branch information
flavorjones authored Jul 18, 2024
2 parents b0738a4 + 6e70867 commit f56af09
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Mechanize CHANGELOG

## next / unreleased

* 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
Expand Down
1 change: 0 additions & 1 deletion lib/mechanize/http/agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,6 @@ def request_host request, uri
end

def request_language_charset request
request['accept-charset'] = 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
request['accept-language'] = 'en-us,en;q=0.5'
end

Expand Down
4 changes: 2 additions & 2 deletions test/test_mechanize_http_agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,8 @@ def test_request_host_nonstandard
def test_request_language_charset
@agent.request_language_charset @req

assert_equal 'en-us,en;q=0.5', @req['accept-language']
assert_equal 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', @req['accept-charset']
assert_equal('en-us,en;q=0.5', @req['accept-language'])
assert_nil(@req['accept-charset'])
end

def test_request_referer
Expand Down

0 comments on commit f56af09

Please sign in to comment.