~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

merge fix for bug #177643

Show diffs side-by-side

added added

removed removed

Lines of Context:
123
123
            # connect to the http server until the first request (which had
124
124
            # just called us).
125
125
            connection = pycurl.Curl()
126
 
            self._set_connection(connection, None)
 
126
            # First request, initialize credentials.
 
127
            auth = self._create_auth()
 
128
            # Proxy handling is out of reach, so we punt
 
129
            self._set_connection(connection, auth)
127
130
        return connection
128
131
 
129
132
    def has(self, relpath):
295
298
        curl.setopt(pycurl.USERAGENT, ua_str)
296
299
        if self.cabundle:
297
300
            curl.setopt(pycurl.CAINFO, self.cabundle)
 
301
        # Set accepted auth methods
 
302
        curl.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_ANY)
 
303
        curl.setopt(pycurl.PROXYAUTH, pycurl.HTTPAUTH_ANY)
 
304
        auth = self._get_credentials()
 
305
        user = auth.get('user', None)
 
306
        password = auth.get('password', None)
 
307
        userpass = None
 
308
        if user is not None:
 
309
            userpass = user + ':'
 
310
            if password is not None: # '' is a valid password
 
311
                userpass += password
 
312
            curl.setopt(pycurl.USERPWD, userpass)
298
313
 
299
314
    def _curl_perform(self, curl, header, more_headers=[]):
300
315
        """Perform curl operation and translate exceptions."""