Skip to content

Commit 4a22c42

Browse files
Update lib/net/http.rb
@natematykiewicz's suggestion to avoid another string allocation Co-authored-by: Nate Matykiewicz <natematykiewicz@gmail.com>
1 parent 925630f commit 4a22c42

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/net/http.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,8 +1615,8 @@ def connect
16151615
write_timeout: @write_timeout,
16161616
continue_timeout: @continue_timeout,
16171617
debug_output: @debug_output)
1618-
buf = +"CONNECT #{conn_address}:#{@port} HTTP/#{HTTPVersion}\r\n"
1619-
buf << "Host: #{@address}:#{@port}\r\n"
1618+
buf = +"CONNECT #{conn_address}:#{@port} HTTP/#{HTTPVersion}\r\n" \
1619+
"Host: #{@address}:#{@port}\r\n"
16201620
if proxy_user
16211621
credential = ["#{proxy_user}:#{proxy_pass}"].pack('m0')
16221622
buf << "Proxy-Authorization: Basic #{credential}\r\n"

0 commit comments

Comments
 (0)