~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2011-08-08 17:52:59 UTC
  • mto: (5268.7.8 transport-segments)
  • mto: This revision was merged to the branch mainline in revision 6062.
  • Revision ID: jelmer@samba.org-20110808175259-putdqc0lnztp367v
Add UnparsedUrl.

Show diffs side-by-side

added added

removed removed

Lines of Context:
996
996
        # grok user:password@host:port as well as
997
997
        # http://user:password@host:port
998
998
 
999
 
        (scheme, user, password,
1000
 
         host, port, path) = transport.ConnectedTransport._split_url(proxy)
1001
 
        if not host:
 
999
        parsed_url = transport.ConnectedTransport._split_url(proxy)
 
1000
        if not parsed_url.host:
1002
1001
            raise errors.InvalidURL(proxy, 'No host component')
1003
1002
 
1004
1003
        if request.proxy_auth == {}:
1006
1005
            # proxied request, intialize.  scheme (the authentication scheme)
1007
1006
            # and realm will be set by the AuthHandler
1008
1007
            request.proxy_auth = {
1009
 
                                  'host': host, 'port': port,
1010
 
                                  'user': user, 'password': password,
1011
 
                                  'protocol': scheme,
 
1008
                                  'host': parsed_url.host,
 
1009
                                  'port': parsed_url.port,
 
1010
                                  'user': parsed_url.user,
 
1011
                                  'password': parsed_url.password,
 
1012
                                  'protocol': parsed_url.scheme,
1012
1013
                                   # We ignore path since we connect to a proxy
1013
1014
                                  'path': None}
1014
 
        if port is None:
1015
 
            phost = host
 
1015
        if parsed_url.port is None:
 
1016
            phost = parsed_url.host
1016
1017
        else:
1017
 
            phost = host + ':%d' % port
 
1018
            phost = parsed_url.host + ':%d' % parsed_url.port
1018
1019
        request.set_proxy(phost, type)
1019
1020
        if self._debuglevel >= 3:
1020
1021
            print 'set_proxy: proxy set to %s://%s' % (type, phost)
1129
1130
        auth['modified'] = False
1130
1131
        # Put some common info in auth if the caller didn't
1131
1132
        if auth.get('path', None) is None:
1132
 
            (protocol, _, _,
1133
 
             host, port, path) = urlutils.parse_url(request.get_full_url())
1134
 
            self.update_auth(auth, 'protocol', protocol)
1135
 
            self.update_auth(auth, 'host', host)
1136
 
            self.update_auth(auth, 'port', port)
1137
 
            self.update_auth(auth, 'path', path)
 
1133
            parsed_url = urlutils.parse_url(request.get_full_url())
 
1134
            self.update_auth(auth, 'protocol', parsed_url.scheme)
 
1135
            self.update_auth(auth, 'host', parsed_url.host)
 
1136
            self.update_auth(auth, 'port', parsed_url.port)
 
1137
            self.update_auth(auth, 'path', parsed_url.path)
1138
1138
        # FIXME: the auth handler should be selected at a single place instead
1139
1139
        # of letting all handlers try to match all headers, but the current
1140
1140
        # design doesn't allow a simple implementation.