ruby-changes:22313
From: shyouhei <ko1@a...>
Date: Mon, 23 Jan 2012 21:25:29 +0900 (JST)
Subject: [ruby-changes:22313] shyouhei:r34362 (trunk): Writing entire packet at once to avoid incomplete transmission
shyouhei 2012-01-23 21:25:19 +0900 (Mon, 23 Jan 2012) New Revision: 34362 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34362 Log: Writing entire packet at once to avoid incomplete transmission Signed-off-by: URABE, Shyouhei <shyouhei@r...> Modified files: trunk/lib/net/http.rb Index: lib/net/http.rb =================================================================== --- lib/net/http.rb (revision 34361) +++ lib/net/http.rb (revision 34362) @@ -811,15 +811,15 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/