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

  • Committer: Vincent Ladeuil
  • Date: 2007-12-11 14:26:18 UTC
  • mto: (3111.1.1 175524)
  • mto: This revision was merged to the branch mainline in revision 3158.
  • Revision ID: v.ladeuil+lp@free.fr-20071211142618-pt6ca80047kok237
Rename bzrlib/test/HTTPTestUtils.py to bzrlib/tests/http_utils.py and fix
uses.  Rename bzrlib/test/HttpServer.py to bzrlib/tests/http_server.py
and fix uses.  Don't pretend we support HTTP/0.9 since we don't and do
that correctly.

* bzrlib/transport/http/_urllib2_wrappers.py:
(AbstractHTTPConnection): Specifying strict here is useless.
(HTTPConnection, HTTPSConnection): We don't support HTTP/0.9 in
other parts of the stack, be explicit *correctly*.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006,2007 Canonical Ltd
 
1
# Copyright (C) 2006, 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
143
143
    """A custom HTTP(S) Connection, which can reset itself on a bad response"""
144
144
 
145
145
    response_class = Response
146
 
    strict = 1 # We don't support HTTP/0.9
147
146
 
148
147
    def __init__(self):
149
148
        self._response = None
181
180
class HTTPConnection(AbstractHTTPConnection, httplib.HTTPConnection):
182
181
 
183
182
    # XXX: Needs refactoring at the caller level.
184
 
    def __init__(self, host, port=None, strict=None, proxied_host=None):
 
183
    def __init__(self, host, port=None, proxied_host=None):
185
184
        AbstractHTTPConnection.__init__(self)
186
 
        httplib.HTTPConnection.__init__(self, host, port, strict)
 
185
        # Use strict=True since we don't support HTTP/0.9
 
186
        httplib.HTTPConnection.__init__(self, host, port, strict=True)
187
187
        self.proxied_host = proxied_host
188
188
 
189
189
    def connect(self):
192
192
        httplib.HTTPConnection.connect(self)
193
193
 
194
194
 
 
195
# FIXME: Should test for ssl availability
195
196
class HTTPSConnection(AbstractHTTPConnection, httplib.HTTPSConnection):
196
197
 
197
198
    def __init__(self, host, port=None, key_file=None, cert_file=None,
198
 
                 strict=None, proxied_host=None):
 
199
                 proxied_host=None):
199
200
        AbstractHTTPConnection.__init__(self)
 
201
        # Use strict=True since we don't support HTTP/0.9
200
202
        httplib.HTTPSConnection.__init__(self, host, port,
201
 
                                         key_file, cert_file, strict)
 
203
                                         key_file, cert_file, strict=True)
202
204
        self.proxied_host = proxied_host
203
205
 
204
206
    def connect(self):
565
567
            # - with and without certificate
566
568
            # - with self-signed certificate
567
569
            # - with and without authentication
568
 
            # - with good and bad credentials (especially the proxy auth aound
 
570
            # - with good and bad credentials (especially the proxy auth around
569
571
            #   CONNECT)
570
572
            # - with basic and digest schemes
571
573
            # - reconnection on errors