Ticket #5677: 5677-fix-http-auth-schema-capitalization-take-2.patch

File 5677-fix-http-auth-schema-capitalization-take-2.patch, 2.3 KB (added by myers, 4 years ago)
  • twisted/web/test/test_httpauth.py

     
    244244        self.assertEqual(request.responseCode, 401)
    245245        self.assertEqual(
    246246            request.responseHeaders.getRawHeaders('www-authenticate'),
    247             ['basic realm="example.com"'])
     247            ['Basic realm="example.com"'])
    248248
    249249
    250250    def test_render(self):
     
    282282        request.render(resource)
    283283        self.assertEqual(
    284284            request.responseHeaders.getRawHeaders('www-authenticate'),
    285             ['basic realm="example\\\\\\"foo"'])
     285            ['Basic realm="example\\\\\\"foo"'])
    286286
    287287
    288288
     
    571571            pass
    572572
    573573        class BadFactory(object):
    574             scheme = 'bad'
     574            scheme = 'Bad'
    575575
    576576            def getChallenge(self, client):
    577577                return {}
  • twisted/web/_auth/digest.py

     
    1919    """
    2020    implements(ICredentialFactory)
    2121
    22     scheme = 'digest'
     22    scheme = 'Digest'
    2323
    2424    def __init__(self, algorithm, authenticationRealm):
    2525        """
  • twisted/web/_auth/wrapper.py

     
    218218            factory can decode the header value.
    219219        """
    220220        elements = header.split(' ')
    221         scheme = elements[0].lower()
     221        scheme = elements[0].title()
    222222        for fact in self._credentialFactories:
    223223            if fact.scheme == scheme:
    224224                return (fact, ' '.join(elements[1:]))
  • twisted/web/_auth/basic.py

     
    2828    """
    2929    implements(ICredentialFactory)
    3030
    31     scheme = 'basic'
     31    scheme = 'Basic'
    3232
    3333    def __init__(self, authenticationRealm):
    3434        self.authenticationRealm = authenticationRealm