Skip to content

Commit

Permalink
HTTP 1.1 header Host: is case sensitive.
Browse files Browse the repository at this point in the history
Thus, fetching www.JarrettBellini.com with
  Host: www.JarrettBellini.com
confused the virtual host.  Instead, we now send
  Host: www.jarrettbellini.com
  • Loading branch information
Blev authored and Blev committed May 5, 2012
1 parent 76eda7c commit 27e1ec5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions retrieve.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def retrieve_page(uri, http_in=nil, extra_headers={}, silent=false)
begin
req = Net::HTTP::Get.new uri.request_uri
req['User-Agent'] = HONEST_USER_AGENT
req['Host'] = uri.host
req['Host'] = uri.host.downcase
req['Accept-Encoding'] = 'gzip, identity'
req['Connection'] = 'Keep-Alive'

Expand Down Expand Up @@ -311,7 +311,7 @@ def retrieve_post(uri, args, http_in=nil, extra_headers={})
begin
req = Net::HTTP::Post.new uri.request_uri
req['User-Agent'] = HONEST_USER_AGENT
req['Host'] = uri.host
req['Host'] = uri.host.downcase
req['Accept-Encoding'] = 'gzip, identity'
req['Connection'] = 'Keep-Alive'

Expand Down Expand Up @@ -466,7 +466,7 @@ def retrieve_head(uri, http_in=nil, extra_headers={}, silent=false)

req = Net::HTTP::Head.new uri.request_uri
req['User-Agent'] = HONEST_USER_AGENT
req['Host'] = uri.host
req['Host'] = uri.host.downcase
req['Connection'] = 'Keep-Alive'

extra_headers.each do |k,v|
Expand Down Expand Up @@ -517,7 +517,7 @@ def retrieve_head(uri, http_in=nil, extra_headers={}, silent=false)
# Try again with HTTP GET
req = Net::HTTP::Get.new uri.request_uri
req['User-Agent'] = HONEST_USER_AGENT
req['Host'] = uri.host
req['Host'] = uri.host.downcase
req['Connection'] = 'Keep-Alive'
req['Accept-Encoding'] = 'gzip, identity'

Expand Down

0 comments on commit 27e1ec5

Please sign in to comment.