~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/http/_urllib2_wrappers.py

  • Committer: Vincent Ladeuil
  • Date: 2011-05-17 21:49:18 UTC
  • mfrom: (5743.12.8 config-options)
  • mto: This revision was merged to the branch mainline in revision 5945.
  • Revision ID: v.ladeuil+lp@free.fr-20110517214918-9w7osyp0i8if0kk0
Merge config-options into config-editor-option

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
        self.report_activity(len(s), 'read')
111
111
        return s
112
112
 
113
 
    # httplib in python 2.4 and 2.5 defines a SSLFile wrapper whose readline
114
 
    # method lacks the size parameter. python2.6 provides a proper ssl socket
115
 
    # and added it. python2.7 uses it, forcing us to provide it.
116
 
    if sys.version_info < (2, 6):
117
 
        def readline(self):
118
 
            s = self.filesock.readline()
119
 
            self.report_activity(len(s), 'read')
120
 
            return s
121
 
    else:
122
 
        def readline(self, size=-1):
123
 
            s = self.filesock.readline(size)
124
 
            self.report_activity(len(s), 'read')
125
 
            return s
 
113
    def readline(self, size=-1):
 
114
        s = self.filesock.readline(size)
 
115
        self.report_activity(len(s), 'read')
 
116
        return s
126
117
 
127
118
    def __getattr__(self, name):
128
119
        return getattr(self.filesock, name)
1402
1393
    if algorithm == 'MD5':
1403
1394
        H = lambda x: osutils.md5(x).hexdigest()
1404
1395
    elif algorithm == 'SHA':
1405
 
        H = lambda x: osutils.sha(x).hexdigest()
 
1396
        H = osutils.sha_string
1406
1397
    if H is not None:
1407
1398
        KD = lambda secret, data: H("%s:%s" % (secret, data))
1408
1399
    return H, KD
1411
1402
def get_new_cnonce(nonce, nonce_count):
1412
1403
    raw = '%s:%d:%s:%s' % (nonce, nonce_count, time.ctime(),
1413
1404
                           urllib2.randombytes(8))
1414
 
    return osutils.sha(raw).hexdigest()[:16]
 
1405
    return osutils.sha_string(raw)[:16]
1415
1406
 
1416
1407
 
1417
1408
class DigestAuthHandler(AbstractAuthHandler):