Replace :ssl_version option with these two new options. These provide
access to OpenSSL::SSL::SSLContext#{min,max}_version=, which is the
recommended way to specify SSL/TLS protocol versions.
`Object#extend(mod)` bump the global constant cache if the module
has constants of its own.
So by moving these constants outside of `Meta` we avoid bumping
the cache.
https://github.com/ruby/open-uri/commit/363c399bac
Thanks for the patch gareth (Gareth Adams). [Bug #15933]
-------
Combines two small, but very related changes
1: Treat HTTPS the same as HTTP
Previously, OpenURI followed guidance in RFC2616/3.7.1:
> When no explicit charset parameter is provided by the sender, media
> subtypes of the "text" type are defined to have a default charset
> value of "ISO-8859-1" when received via HTTP.
However this RFC was written before TLS was established and OpenURI was
never updated to treat HTTPS traffic the same way. So, HTTPS documents
received a different default to HTTP documents.
This commit removes the scheme check so that all text/* documents
processed by OpenURI are treated the same way.
In theory this processing gets applied to FTP URIs too, but there's no
mechanism in OpenURI for FTP documents to have Content-Type metadata
appended to them, so this ends up being a no-op.
2: Change default charset for text/* to UTF-8
Replaces the default ISO-8859-1 charset previously defined in RFC2616 (now
obsoleted) with a UTF-8 charset as defined in RFC6838.
Fixes: https://bugs.ruby-lang.org/issues/15933
StringIO.new makes the buffer IO.default_external, while
StringIO.new("".dup) makes source encoding which is defaulted to
UTF-8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/open-uri/test_ssl.rb: Regenerate test certificates. The test CA
certificate was incorrectly generated. A CA certificate must have the
basic constraints extension with cA bit set to TRUE. OpenSSL <= 1.0.2
allowed the error when the certificate is in the trusted store but
OpenSSL 1.1.0 no longer does.
[ruby-core:75225] [Feature #12324]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/open-uri/test_ssl.rb, test/webrick/test_httpproxy.rb: also
depends on test/openssl/utils.rb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(TestNetHTTPS#test_certificate_verify_failure): on Windows,
Errno::ECONNRESET will be raised when the verify is failure at the
client side, and it'll be eaten by WEBrick.
* test/open-uri/test_ssl.rb (TestOpenURISSL#test_validation_failure):
ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
the StringIO object is not closed yet.
Reported by Jordi Massaguer Pla. [ruby-core:42538] [Bug #6010]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
name (like Set-Cookie).
(OpenURI::Meta#metas): New accessor to obtain fields as a Hash from
field name (string) to field values (array of strings).
[ruby-core:37734] [Bug #4964] reported by ren li.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
test expects that the server thread will be killed in sleep, but 0.01
sec is too short to reach there.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
proxies from the environment. A proxy may also be specified as
before.
Net::HTTP::Proxy still creates anonymous classes, but these classes
are only used to store configuration information. When an HTTP
instance is created the configuration is now copied.
Additionally, Net::HTTP::ProxyDelta is no longer used by Net::HTTP
[Feature #6546]
* lib/open-uri.rb: Moved URI::Generic#find_proxy to uri/generic.
* lib/uri/generic.rb: Imported find_proxy from open-uri.
* test/open-uri/test_open-uri.rb: Moved proxy-discovery tests to URI.
* test/uri/test_generic.rb: Imported proxy-discovery tests from
open-uri.
* test/net/http/test_http.rb: Added tests for proxy behavior.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
deflate-encoded response bodies. [Feature #6942]
* lib/net/http/generic_request.rb: Automatically accept gzip and
deflate content-encoding for requests. [Feature #6494]
* lib/net/http/request.rb: Updated documentation for #6494.
* lib/net/http.rb: Updated documentation for #6492 and #6494, removed
Content-Encoding handling now present in Net::HTTPResponse.
* test/net/http/test_httpresponse.rb: Tests for #6492
* test/net/http/test_http_request.rb: Tests for #6494
* test/open-uri/test_open-uri.rb (test_content_encoding): Updated test
for automatic content-encoding handling.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e