diff options
author | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-06-30 05:58:42 +0000 |
---|---|---|
committer | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-06-30 05:58:42 +0000 |
commit | 7fb6a090230983f341882bc043f2efcb80e3eff9 (patch) | |
tree | 1ece44ead84bd4f5eab9107425aa2e7bb68e9b0d | |
parent | 13212d08f1b6bd78aa1cabcaca60ae82391abf4a (diff) | |
download | ruby-7fb6a090230983f341882bc043f2efcb80e3eff9.tar.gz |
* lib/net/http.rb (Net::HTTP#connect, Net::HTTP#request): should
not send proxy username and password to origin servers.
[ruby-dev:25673]
* lib/net/http.rb (Net::HTTP::ProxyDelta#edit_path): should not
send HTTPS scheme URL to origine servers. [ruby-dev:25689]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | lib/net/http.rb | 16 |
2 files changed, 19 insertions, 6 deletions
@@ -1,3 +1,12 @@ +Thu Jun 30 14:48:23 2005 GOTOU Yuuzou <gotoyuzo@notwork.org> + + * lib/net/http.rb (Net::HTTP#connect, Net::HTTP#request): should + not send proxy username and password to origin servers. + [ruby-dev:25673] + + * lib/net/http.rb (Net::HTTP::ProxyDelta#edit_path): should not + send HTTPS scheme URL to origine servers. [ruby-dev:25689] + Wed Jun 29 00:03:20 2005 Kazuhiro NISHIYAMA <zn@mbf.nifty.com> * regparse.c (fetch_token): avoid warning of unused goto tag. diff --git a/lib/net/http.rb b/lib/net/http.rb index 5f40a47602..aa5d5de136 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -521,6 +521,12 @@ module Net # :nodoc: if proxy? @socket.writeline sprintf('CONNECT %s:%s HTTP/%s', @address, @port, HTTPVersion) + @socket.writeline "Host: #{@address}:#{@port}" + if proxy_user + credential = ["#{proxy_user}:#{proxy_pass}"].pack('m') + credential.delete!("\r\n") + @socket.writeline "Proxy-Authorization: Basic #{credential}" + end @socket.writeline '' HTTPResponse.read_new(@socket).value end @@ -660,11 +666,7 @@ module Net # :nodoc: end def edit_path(path) - if use_ssl? - "https://#{addr_port()}#{path}" - else - "http://#{addr_port()}#{path}" - end + use_ssl? ? path : "http://#{addr_port()}#{path}" end end @@ -983,7 +985,9 @@ module Net # :nodoc: } end if proxy_user() - req.proxy_basic_auth proxy_user(), proxy_pass() + unless use_ssl? + req.proxy_basic_auth proxy_user(), proxy_pass() + end end req.set_body_internal body |