/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/http_utils.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-08-01 23:17:05 UTC
  • mfrom: (7045.5.11 python3-w)
  • Revision ID: breezy.the.bot@gmail.com-20180801231705-ajjz4uihoohy1ufm
Fix another ~400 tests on Python 3.

Merged from https://code.launchpad.net/~jelmer/brz/python3-w/+merge/352048

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
import base64
17
18
import re
18
19
try:
19
20
    from urllib.request import (
333
334
        if auth_header:
334
335
            scheme, raw_auth = auth_header.split(' ', 1)
335
336
            if scheme.lower() == tcs.auth_scheme:
336
 
                user, password = raw_auth.decode('base64').split(':')
 
337
                user, password = base64.b64decode(raw_auth).split(b':')
337
338
                return tcs.authorized(user, password)
338
339
 
339
340
        return False
410
411
    auth_header_sent = None
411
412
    auth_header_recv = None
412
413
    auth_error_code = None
413
 
    auth_realm = "Thou should not pass"
 
414
    auth_realm = u"Thou should not pass"
414
415
 
415
416
    def __init__(self, request_handler, auth_scheme,
416
417
                 protocol_version=None):
470
471
 
471
472
        # Recalculate the response_digest to compare with the one
472
473
        # sent by the client
473
 
        A1 = '%s:%s:%s' % (user, realm, password)
474
 
        A2 = '%s:%s' % (command, auth['uri'])
 
474
        A1 = ('%s:%s:%s' % (user, realm, password)).encode('utf-8')
 
475
        A2 = ('%s:%s' % (command, auth['uri'])).encode('utf-8')
475
476
 
476
477
        H = lambda x: osutils.md5(x).hexdigest()
477
 
        KD = lambda secret, data: H("%s:%s" % (secret, data))
 
478
        KD = lambda secret, data: H(("%s:%s" % (secret, data)).encode('utf-8'))
478
479
 
479
480
        nonce_count = int(auth['nc'], 16)
480
481