Skip to content

Commit

Permalink
Writing entire packet at once to avoid incomplete transmission
Browse files Browse the repository at this point in the history
Signed-off-by: URABE, Shyouhei <[email protected]>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
shyouhei committed Jan 23, 2012
1 parent 44d7233 commit 5de2c3c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/net/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -811,15 +811,15 @@ def connect
if use_ssl?
begin
if proxy?
@socket.writeline sprintf('CONNECT %s:%s HTTP/%s',
@address, @port, HTTPVersion)
@socket.writeline "Host: #{@address}:#{@port}"
buf = "CONNECT #{@address}:#{@port} HTTP/#{HTTPVersion}\r\n"
buf << "Host: #{@address}:#{@port}\r\n"
if proxy_user
credential = ["#{proxy_user}:#{proxy_pass}"].pack('m')
credential.delete!("\r\n")
@socket.writeline "Proxy-Authorization: Basic #{credential}"
buf << "Proxy-Authorization: Basic #{credential}\r\n"
end
@socket.writeline ''
buf << "\r\n"
@socket.write(buf)
HTTPResponse.read_new(@socket).value
end
# Server Name Indication (SNI) RFC 3546
Expand Down

0 comments on commit 5de2c3c

Please sign in to comment.