This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: httplib debuglevel on CONNECT doesn't print response headers
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, Matt.Spear, berker.peksag, demian.brecht, orsenthil, python-dev
Priority: normal Keywords: patch

Created on 2011-10-08 05:11 by Matt.Spear, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit Matt.Spear, 2011-10-08 05:11 Add printing of the headers to CONNECT
issue13128.patch demian.brecht, 2014-07-21 23:34 review
issue13128_2.patch demian.brecht, 2015-01-07 06:21 review
issue13128_3.patch demian.brecht, 2015-01-28 15:25 review
Messages (10)
msg145157 - (view) Author: Matt Spear (Matt.Spear) Date: 2011-10-08 05:11
httplib with a debuglevel prints out the response headers, but does not do so with CONNECT requests (when set_tunnel is used).  Attached is a small patch to print the reply when the CONNECT request returns something other than 200 OK.  I'm not sure if it is worth printing the headers when a 200 OK is given.  If it seems useful I can update the patch.

msg221913 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-29 22:55
The httplib module has been renamed to http.client in Python 3, besides which the attached patch isn't in the standard format that is used here.
msg223618 - (view) Author: Demian Brecht (demian.brecht) * (Python triager) Date: 2014-07-21 23:34
Attached a simple fix to the problem as written, matching logging method of HTTPResponse.begin().
msg233563 - (view) Author: Demian Brecht (demian.brecht) * (Python triager) Date: 2015-01-07 06:21
Just happened to come across this now. Updated patch with test.
msg234859 - (view) Author: Demian Brecht (demian.brecht) * (Python triager) Date: 2015-01-27 22:45
msg234861 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2015-01-27 22:58
Thanks for the patch! Could you revert unrelated changes (whitespaces, PEP 8 etc.) if you have time?
msg234862 - (view) Author: Demian Brecht (demian.brecht) * (Python triager) Date: 2015-01-27 23:10
Sure, I should have some time later today to do so.

Should such changes not be made as they're encountered in order to clean
up the older code that isn't up to spec? Or should they only be made as
the code is modified?

On 2015-01-27 2:58 PM, Berker Peksag wrote:
> Berker Peksag added the comment:
> Thanks for the patch! Could you revert unrelated changes (whitespaces, PEP 8 etc.) if you have time?
> ----------
> stage: patch review -> commit review
> _______________________________________
> Python tracker <>
> <>
> _______________________________________
msg234897 - (view) Author: Demian Brecht (demian.brecht) * (Python triager) Date: 2015-01-28 15:25
New patch removes unrelated changes.
msg235333 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-02-03 10:22
New changeset dfbd07cdc031 by Berker Peksag in branch 'default':
Issue #13128: Print response headers for CONNECT requests when debuglevel > 0.
msg235334 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2015-02-03 10:25
Thanks for the patch, Demian. I've simplified the test code a bit and committed it. Also, thanks for the report and for the initial patch Matt.
Date User Action Args
2022-04-11 14:57:22adminsetgithub: 57337
2015-02-03 10:25:14berker.peksagsetstatus: open -> closed
resolution: fixed
messages: + msg235334

stage: commit review -> resolved
2015-02-03 10:22:06python-devsetnosy: + python-dev
messages: + msg235333
2015-01-28 15:25:20demian.brechtsetfiles: + issue13128_3.patch

messages: + msg234897
2015-01-27 23:10:44demian.brechtsetmessages: + msg234862
2015-01-27 22:58:23berker.peksagsetmessages: + msg234861
stage: patch review -> commit review
2015-01-27 22:45:44demian.brechtsetmessages: + msg234859
2015-01-07 06:21:34demian.brechtsetfiles: + issue13128_2.patch

messages: + msg233563
2014-10-09 05:37:44berker.peksagsetnosy: + berker.peksag

versions: + Python 3.5, - Python 3.3
2014-07-21 23:34:02demian.brechtsetfiles: + issue13128.patch
nosy: + demian.brecht
messages: + msg223618

2014-06-29 22:55:36BreamoreBoysetnosy: + BreamoreBoy
messages: + msg221913
2012-01-05 15:47:39pitrousetnosy: + orsenthil

versions: + Python 3.3, - Python 2.7
2012-01-04 04:39:52ned.deilysetstage: patch review
2011-10-08 05:11:44Matt.Spearcreate