From a7d7be5ce04c40f8afe870b00542c6d23732999f Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Fri, 13 May 2011 01:01:53 +0000 Subject: [PATCH] bug fix ('Host' header was being set to the conf.hostname for all getPages causing problems in some cases when retrieved page was not coming from that same Host) --- lib/core/enums.py | 1 + lib/core/option.py | 3 --- lib/request/connect.py | 2 ++ 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/core/enums.py b/lib/core/enums.py index a176b4e91..d6608c65d 100644 --- a/lib/core/enums.py +++ b/lib/core/enums.py @@ -88,6 +88,7 @@ class HTTPHEADER: CONTENT_RANGE = "Content-Range" CONTENT_TYPE = "Content-Type" COOKIE = "Cookie" + HOST = "Host" PROXY_AUTHORIZATION = "Proxy-authorization" RANGE = "Range" REFERER = "Referer" diff --git a/lib/core/option.py b/lib/core/option.py index abed16dd4..4a528b97d 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -1027,9 +1027,6 @@ def __setHTTPMethod(): logger.debug(debugMsg) def __setHTTPExtraHeaders(): - if conf.hostname: - conf.httpHeaders.append(("Host", conf.hostname)) - if conf.headers: debugMsg = "setting extra HTTP headers" logger.debug(debugMsg) diff --git a/lib/request/connect.py b/lib/request/connect.py index 5b4c4fb42..1dbdb8476 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -178,6 +178,8 @@ class Connect: if kb.proxyAuthHeader: headers[HTTPHEADER.PROXY_AUTHORIZATION] = kb.proxyAuthHeader + headers[HTTPHEADER.HOST] = urlparse.urlparse(url).netloc + if auxHeaders: for key, item in auxHeaders.items(): headers[key] = item