From d8793afccfc5a94095600028308a96b972b573ae Mon Sep 17 00:00:00 2001 From: ivannotes Date: Fri, 1 Aug 2014 09:22:58 +0800 Subject: [PATCH] Bugfix for leaking Proxy-Authorization header to remote host when using tunneling --- scrapy/core/downloader/handlers/http11.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scrapy/core/downloader/handlers/http11.py b/scrapy/core/downloader/handlers/http11.py index 617a68ea4..926d8b655 100644 --- a/scrapy/core/downloader/handlers/http11.py +++ b/scrapy/core/downloader/handlers/http11.py @@ -166,6 +166,8 @@ class ScrapyAgent(object): url = urldefrag(request.url)[0] method = request.method headers = TxHeaders(request.headers) + if isinstance(agent, self._TunnelingAgent): + headers.removeHeader('Proxy-Authorization') bodyproducer = _RequestBodyProducer(request.body) if request.body else None start_time = time()