Permalink
Browse files

Merge pull request #193 from chrisrhoden/patch-2

Remove port from Host: header when port == 80
  • Loading branch information...
2 parents 2a3ab8e + a822437 commit 1a217faeb15c57766fe94b646216c221d6c9e8a7 @tmm1 tmm1 committed Feb 28, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/em/protocols/httpclient.rb
@@ -127,7 +127,7 @@ def send_request args
# Allow an override for the host header if it's not the connect-string.
host = args[:host_header] || args[:host] || "_"
# For now, ALWAYS tuck in the port string, although we may want to omit it if it's the default.
- port = args[:port]
+ port = args[:port].to_i != 80 ? ":#{args[:port]}" : ""
# POST items.
postcontenttype = args[:contenttype] || "application/octet-stream"
@@ -138,7 +138,7 @@ def send_request args
# TODO: We ASSUME the caller wants to send a 1.1 request. May not be a good assumption.
req = [
"#{verb} #{request}#{qs} HTTP/#{version}",
- "Host: #{host}:#{port}",
+ "Host: #{host}#{port}",
"User-agent: Ruby EventMachine",
]

0 comments on commit 1a217fa

Please sign in to comment.