From 3f6c3b40dd977ae3dc6f37a3b5029a07d8907625 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 3 Mar 2015 14:37:36 +0100 Subject: [PATCH 1/2] Minor update (not overriding user given 'Accept-Encoding' header value) --- lib/request/connect.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/request/connect.py b/lib/request/connect.py index 82e7290f9..e2e7d2a18 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -332,7 +332,9 @@ class Connect(object): if HTTP_HEADER.ACCEPT not in headers: headers[HTTP_HEADER.ACCEPT] = HTTP_ACCEPT_HEADER_VALUE - headers[HTTP_HEADER.ACCEPT_ENCODING] = HTTP_ACCEPT_ENCODING_HEADER_VALUE if kb.pageCompress else "identity" + if HTTP_HEADER.ACCEPT_ENCODING not in headers: + headers[HTTP_HEADER.ACCEPT_ENCODING] = HTTP_ACCEPT_ENCODING_HEADER_VALUE if kb.pageCompress else "identity" + headers[HTTP_HEADER.HOST] = host or getHostHeader(url) if post is not None and HTTP_HEADER.CONTENT_TYPE not in headers: From 3347fc25ca74baee17a0b2388631c9b5252ecdcc Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 3 Mar 2015 15:10:06 +0100 Subject: [PATCH 2/2] Fixes #1185 --- lib/request/httpshandler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/request/httpshandler.py b/lib/request/httpshandler.py index aa24eb474..7ea178160 100644 --- a/lib/request/httpshandler.py +++ b/lib/request/httpshandler.py @@ -53,7 +53,8 @@ class HTTPSConnection(httplib.HTTPSConnection): break else: sock.close() - except (ssl.SSLError, socket.error), errMsg: + except (ssl.SSLError, socket.error, httplib.BadStatusLine), errMsg: + self._tunnel_host = None logger.debug("SSL connection error occurred ('%s')" % errMsg) if not success: