Writing entire packet at once to avoid incomplete transmission
Signed-off-by: URABE, Shyouhei <shyouhei@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
44d7233201
commit
5de2c3c2d3
@ -811,15 +811,15 @@ module Net #:nodoc:
|
|||||||
if use_ssl?
|
if use_ssl?
|
||||||
begin
|
begin
|
||||||
if proxy?
|
if proxy?
|
||||||
@socket.writeline sprintf('CONNECT %s:%s HTTP/%s',
|
buf = "CONNECT #{@address}:#{@port} HTTP/#{HTTPVersion}\r\n"
|
||||||
@address, @port, HTTPVersion)
|
buf << "Host: #{@address}:#{@port}\r\n"
|
||||||
@socket.writeline "Host: #{@address}:#{@port}"
|
|
||||||
if proxy_user
|
if proxy_user
|
||||||
credential = ["#{proxy_user}:#{proxy_pass}"].pack('m')
|
credential = ["#{proxy_user}:#{proxy_pass}"].pack('m')
|
||||||
credential.delete!("\r\n")
|
credential.delete!("\r\n")
|
||||||
@socket.writeline "Proxy-Authorization: Basic #{credential}"
|
buf << "Proxy-Authorization: Basic #{credential}\r\n"
|
||||||
end
|
end
|
||||||
@socket.writeline ''
|
buf << "\r\n"
|
||||||
|
@socket.write(buf)
|
||||||
HTTPResponse.read_new(@socket).value
|
HTTPResponse.read_new(@socket).value
|
||||||
end
|
end
|
||||||
# Server Name Indication (SNI) RFC 3546
|
# Server Name Indication (SNI) RFC 3546
|
||||||
|
Loading…
x
Reference in New Issue
Block a user