/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/__init__.py

  • Committer: John Arbash Meinel
  • Date: 2008-06-05 16:27:16 UTC
  • mfrom: (3475 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3476.
  • Revision ID: john@arbash-meinel.com-20080605162716-a3hn238tnctbfd8j
merge bzr.dev, resolve NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
from bzrlib.smart import medium
35
35
from bzrlib.symbol_versioning import (
36
36
        deprecated_method,
37
 
        zero_seventeen,
38
37
        )
39
38
from bzrlib.trace import mutter
40
39
from bzrlib.transport import (
52
51
    password manager.  Return the url, minus those auth parameters (which
53
52
    confuse urllib2).
54
53
    """
55
 
    assert re.match(r'^(https?)(\+\w+)?://', url), \
56
 
            'invalid absolute url %r' % url
 
54
    if not re.match(r'^(https?)(\+\w+)?://', url):
 
55
        raise ValueError(
 
56
            'invalid absolute url %r' % (url,))
57
57
    scheme, netloc, path, query, fragment = urlparse.urlsplit(url)
58
58
 
59
59
    if '@' in netloc:
514
514
        return ','.join(strings)
515
515
 
516
516
    def send_http_smart_request(self, bytes):
517
 
        code, body_filelike = self._post(bytes)
518
 
        assert code == 200, 'unexpected HTTP response code %r' % (code,)
 
517
        try:
 
518
            code, body_filelike = self._post(bytes)
 
519
            if code != 200:
 
520
                raise InvalidHttpResponse(
 
521
                    self._remote_path('.bzr/smart'),
 
522
                    'Expected 200 response code, got %r' % (code,))
 
523
        except errors.InvalidHttpResponse, e:
 
524
            raise errors.SmartProtocolError(str(e))
519
525
        return body_filelike
520
526
 
 
527
    def should_probe(self):
 
528
        return True
 
529
 
 
530
    def remote_path_from_transport(self, transport):
 
531
        # Strip the optional 'bzr+' prefix from transport so it will have the
 
532
        # same scheme as self.
 
533
        transport_base = transport.base
 
534
        if transport_base.startswith('bzr+'):
 
535
            transport_base = transport_base[4:]
 
536
        rel_url = urlutils.relative_url(self.base, transport_base)
 
537
        return urllib.unquote(rel_url)
 
538
 
521
539
 
522
540
class SmartClientHTTPMediumRequest(medium.SmartClientMediumRequest):
523
541
    """A SmartClientMediumRequest that works with an HTTP medium."""