Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

httplib debuglevel on CONNECT doesn't print response headers #57337

Closed
MattSpear mannequin opened this issue Oct 8, 2011 · 10 comments
Closed

httplib debuglevel on CONNECT doesn't print response headers #57337

MattSpear mannequin opened this issue Oct 8, 2011 · 10 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@MattSpear
Copy link
Mannequin

MattSpear mannequin commented Oct 8, 2011

BPO 13128
Nosy @orsenthil, @berkerpeksag, @demianbrecht
Files
  • httplib.py.patch: Add printing of the headers to CONNECT
  • issue13128.patch
  • issue13128_2.patch
  • issue13128_3.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2015-02-03.10:25:14.053>
    created_at = <Date 2011-10-08.05:11:44.381>
    labels = ['type-feature', 'library']
    title = "httplib debuglevel on CONNECT doesn't print response headers"
    updated_at = <Date 2015-02-03.10:25:14.052>
    user = 'https://bugs.python.org/MattSpear'

    bugs.python.org fields:

    activity = <Date 2015-02-03.10:25:14.052>
    actor = 'berker.peksag'
    assignee = 'none'
    closed = True
    closed_date = <Date 2015-02-03.10:25:14.053>
    closer = 'berker.peksag'
    components = ['Library (Lib)']
    creation = <Date 2011-10-08.05:11:44.381>
    creator = 'Matt.Spear'
    dependencies = []
    files = ['23342', '36018', '37621', '37892']
    hgrepos = []
    issue_num = 13128
    keywords = ['patch']
    message_count = 10.0
    messages = ['145157', '221913', '223618', '233563', '234859', '234861', '234862', '234897', '235333', '235334']
    nosy_count = 6.0
    nosy_names = ['orsenthil', 'BreamoreBoy', 'python-dev', 'berker.peksag', 'Matt.Spear', 'demian.brecht']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue13128'
    versions = ['Python 3.5']

    @MattSpear
    Copy link
    Mannequin Author

    MattSpear mannequin commented Oct 8, 2011

    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.

    Thanks!!!

    @MattSpear MattSpear mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Oct 8, 2011
    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jun 29, 2014

    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.

    @demianbrecht
    Copy link
    Mannequin

    demianbrecht mannequin commented Jul 21, 2014

    Attached a simple fix to the problem as written, matching logging method of HTTPResponse.begin().

    @demianbrecht
    Copy link
    Mannequin

    demianbrecht mannequin commented Jan 7, 2015

    Just happened to come across this now. Updated patch with test.

    @demianbrecht
    Copy link
    Mannequin

    demianbrecht mannequin commented Jan 27, 2015

    Ping.

    @berkerpeksag
    Copy link
    Member

    Thanks for the patch! Could you revert unrelated changes (whitespaces, PEP-8 etc.) if you have time?

    @demianbrecht
    Copy link
    Mannequin

    demianbrecht mannequin commented Jan 27, 2015

    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 <report@bugs.python.org>
    <http://bugs.python.org/issue13128\>


    @demianbrecht
    Copy link
    Mannequin

    demianbrecht mannequin commented Jan 28, 2015

    New patch removes unrelated changes.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Feb 3, 2015

    New changeset dfbd07cdc031 by Berker Peksag in branch 'default':
    Issue bpo-13128: Print response headers for CONNECT requests when debuglevel > 0.
    https://hg.python.org/cpython/rev/dfbd07cdc031

    @berkerpeksag
    Copy link
    Member

    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.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant