~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/remote.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-01-15 00:34:05 UTC
  • mfrom: (3104.4.7 bzr-http-client)
  • Revision ID: pqm@pqm.ubuntu.com-20080115003405-jfuumkpctmvl2e4r
(andrew) Calculate remote path relative to the shared medium in
        _SmartClient.

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
                    trace.mutter('hpss: Built a new medium: %s',
103
103
                                 medium.__class__.__name__)
104
104
            self._shared_connection = transport._SharedConnection(medium,
105
 
                                                                  credentials)
 
105
                                                                  credentials,
 
106
                                                                  self.base)
106
107
 
107
108
        if _client is None:
108
109
            self._client = client._SmartClient(self.get_shared_medium())
502
503
        """After connecting, HTTP Transport only deals in relative URLs."""
503
504
        # Adjust the relpath based on which URL this smart transport is
504
505
        # connected to.
505
 
        http_base = urlutils.normalize_url(self._http_transport.base)
 
506
        http_base = urlutils.normalize_url(self.get_smart_medium().base)
506
507
        url = urlutils.join(self.base[len('bzr+'):], relpath)
507
508
        url = urlutils.normalize_url(url)
508
509
        return urlutils.relative_url(http_base, url)
519
520
        smart requests may be different).  This is so that the server doesn't
520
521
        have to handle .bzr/smart requests at arbitrary places inside .bzr
521
522
        directories, just at the initial URL the user uses.
522
 
 
523
 
        The exception is parent paths (i.e. relative_url of "..").
524
523
        """
525
524
        if relative_url:
526
525
            abs_url = self.abspath(relative_url)
527
526
        else:
528
527
            abs_url = self.base
529
 
        # We either use the exact same http_transport (for child locations), or
530
 
        # a clone of the underlying http_transport (for parent locations).  This
531
 
        # means we share the connection.
532
 
        norm_base = urlutils.normalize_url(self.base)
533
 
        norm_abs_url = urlutils.normalize_url(abs_url)
534
 
        normalized_rel_url = urlutils.relative_url(norm_base, norm_abs_url)
535
 
        if normalized_rel_url == ".." or normalized_rel_url.startswith("../"):
536
 
            http_transport = self._http_transport.clone(normalized_rel_url)
537
 
        else:
538
 
            http_transport = self._http_transport
539
528
        return RemoteHTTPTransport(abs_url,
540
529
                                   _from_transport=self,
541
 
                                   http_transport=http_transport)
 
530
                                   http_transport=self._http_transport)
542
531
 
543
532
 
544
533
def get_test_permutations():