Skip to content

Commit 33441a6

Browse files
taketo1113sorah
andauthored
Update lib/net/http/generic_request.rb
Co-authored-by: Sorah Fukumori <sora134@gmail.com>
1 parent 9533812 commit 33441a6

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/net/http/generic_request.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ def initialize(m, reqbody, resbody, uri_or_path, initheader = nil) # :nodoc:
5252
initialize_http_header initheader
5353
self['Accept'] ||= '*/*'
5454
self['User-Agent'] ||= 'Ruby'
55-
host = @host.dup
56-
host << ":" << @port.to_s if @port
57-
self['Host'] ||= "#{host}" if host
55+
self['Host'] ||= @port ? "#{@host}:#{@port}" : @host if @host
5856
@body = nil
5957
@body_stream = nil
6058
@body_data = nil

0 commit comments

Comments
 (0)