diff options
| author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-07-05 17:24:41 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-07-08 04:53:11 +0000 |
| commit | 61e00856c99eadbb1fd31c432a68783ecddbab4a (patch) | |
| tree | f86e8f297f31e65f68703177a4251cdb5e5effce | |
| parent | e6b6c2ba9d7726ca7f00051e0cd30cdf9615686a (diff) | |
[ruby/open-uri] Don't use URI library
https://github.com/ruby/open-uri/commit/15989970b6
| -rw-r--r-- | test/open-uri/utils.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/test/open-uri/utils.rb b/test/open-uri/utils.rb index 3334079d09..88b0797904 100644 --- a/test/open-uri/utils.rb +++ b/test/open-uri/utils.rb @@ -196,8 +196,7 @@ class SimpleHTTPProxyServer if method == 'CONNECT' proxy_connect(path, client) else - uri = URI(path) - proxy_request(uri, client) + proxy_request(path, client) end rescue TestOpenURIProxy::ProxyAuthenticationRequired @log << "ERROR ProxyAuthenticationRequired" @@ -226,9 +225,12 @@ class SimpleHTTPProxyServer end end - def proxy_request(uri, client) - Net::HTTP.start(uri.host, uri.port) do |http| - response = http.get(uri.path) + def proxy_request(path, client) + path.gsub!(/\Ahttps?:\/\//, '') + host, path = path.split('/') + host, port = host.split(':') + Net::HTTP.start(host, port) do |http| + response = http.get("/#{path}") client.print "HTTP/1.1 #{response.code}\r\nContent-Type: #{response.content_type}\r\n\r\n#{response.body}" end end |
