/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 bzrlib/transport/http/_pycurl.py

  • Committer: Vincent Ladeuil
  • Date: 2007-12-20 19:38:45 UTC
  • mfrom: (3133.1.3 177643)
  • mto: This revision was merged to the branch mainline in revision 3137.
  • Revision ID: v.ladeuil+lp@free.fr-20071220193845-bwttzbjqjppw8602
Fix bug #177643 by handling credentials embedded in urls works again for pycurl

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."""