From 61e00856c99eadbb1fd31c432a68783ecddbab4a Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Fri, 5 Jul 2024 17:24:41 +0900 Subject: [ruby/open-uri] Don't use URI library https://github.com/ruby/open-uri/commit/15989970b6 --- test/open-uri/utils.rb | 12 +++++++----- 1 file 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 -- cgit v1.2.3