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

urllib2 digest auth totally broken #40447

Closed
aaronsw mannequin opened this issue Jun 25, 2004 · 6 comments
Closed

urllib2 digest auth totally broken #40447

aaronsw mannequin opened this issue Jun 25, 2004 · 6 comments
Labels
easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@aaronsw
Copy link
Mannequin

aaronsw mannequin commented Jun 25, 2004

BPO 979407
Nosy @birkenfeld, @orsenthil, @vstinner, @tiran, @mmaker
Dependencies
  • bpo-944396: urllib2 doesn't handle username/password in url
  • 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 2013-07-07.14:40:51.408>
    created_at = <Date 2004-06-25.01:16:37.000>
    labels = ['easy', 'type-bug', 'library']
    title = 'urllib2 digest auth totally broken'
    updated_at = <Date 2013-07-07.14:40:51.406>
    user = 'https://bugs.python.org/aaronsw'

    bugs.python.org fields:

    activity = <Date 2013-07-07.14:40:51.406>
    actor = 'christian.heimes'
    assignee = 'none'
    closed = True
    closed_date = <Date 2013-07-07.14:40:51.408>
    closer = 'christian.heimes'
    components = ['Library (Lib)']
    creation = <Date 2004-06-25.01:16:37.000>
    creator = 'aaronsw'
    dependencies = ['944396']
    files = []
    hgrepos = []
    issue_num = 979407
    keywords = ['easy']
    message_count = 6.0
    messages = ['60522', '60523', '182136', '182154', '192438', '192564']
    nosy_count = 9.0
    nosy_names = ['aaronsw', 'georg.brandl', 'jjlee', 'orsenthil', 'vstinner', 'christian.heimes', 'maker', 'asandvig', 'senko']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue979407'
    versions = ['Python 3.1', 'Python 2.7', 'Python 3.2']

    @aaronsw
    Copy link
    Mannequin Author

    aaronsw mannequin commented Jun 25, 2004

    The urllib2 digest auth handler is totally broken.

    1. It looks for an "Authorization" header instead of "WWW-
      Authenticate" (Authorization is the header you send back).

    2. It thinks passwords in the URL are port names.

    3. Even if you get around all that, it just doesn't work. It seems
      to encrypt the thing wrongly and get itself into an infinite loop
      sending the wrong answer back again and again, being rejected
      each time.

    @birkenfeld
    Copy link
    Member

    Logged In: YES
    user_id=849994

    For discussion about number 2 above, see bpo-944396.

    @devdanzin devdanzin mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Feb 12, 2009
    @devdanzin devdanzin mannequin added easy labels Apr 22, 2009
    @mmaker
    Copy link
    Mannequin

    mmaker mannequin commented Feb 15, 2013

    Isn't this issue fixed and tested on Lib/test/test_urllib2.py:1304?

    @orsenthil
    Copy link
    Member

    let me check that.

    @senko
    Copy link
    Mannequin

    senko mannequin commented Jul 6, 2013

    Checked with 3.4.0 alpha, works fine. Apart from the tests mentioned, I used the following script to check digest auth:

        from urllib import request
    
        url = 'http://httpbin.org/digest-auth/auth/user/passwd'
        req = request.Request(url)
    
        password_manager = request.HTTPPasswordMgrWithDefaultRealm()
        password_manager.add_password(None, url, 'user', 'passwd')
    
        auth_manager = request.HTTPDigestAuthHandler(password_manager)
        opener = request.build_opener(auth_manager)
    
        request.install_opener(opener)
        handler = request.urlopen(req)
    assert handler.getcode() == 200
    

    @tiran
    Copy link
    Member

    tiran commented Jul 7, 2013

    The bug has been fixed a while ago. Python 2.7 as well as Python 3.x have tests to verify digest auth.

    Farewell Aaron...

    @tiran tiran closed this as completed Jul 7, 2013
    @tiran tiran closed this as completed Jul 7, 2013
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants