Permalink
Browse files

HTTP 1.1 header Host: is case sensitive.

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 Blev
Blev authored and Blev committed May 5, 2012
1 parent 76eda7c commit 27e1ec5848443fdc49845398efbb3a5145a700ba
Showing with 4 additions and 4 deletions.
  1. +4 −4 retrieve.rb
View
@@ -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'
@@ -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'
@@ -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|
@@ -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'

0 comments on commit 27e1ec5

Please sign in to comment.