summaryrefslogtreecommitdiff
path: root/lib/net
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-23 12:25:19 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-23 12:25:19 +0000
commit5de2c3c2d3aedc304ca87ff224c9e4a6ec7cb14a (patch)
tree162ff9c9c7588bb02203ed3804741ef618cba0af /lib/net
parent44d72332014b5feac64efd25cde6d122067b7019 (diff)
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
Diffstat (limited to 'lib/net')
-rw-r--r--lib/net/http.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb
index 53093492c2..b6e5de0a54 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -811,15 +811,15 @@ module Net #:nodoc:
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