~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2007-02-12 14:02:01 UTC
  • mto: (2323.7.1 redirection)
  • mto: This revision was merged to the branch mainline in revision 2390.
  • Revision ID: v.ladeuil+lp@free.fr-20070212140201-khf5tnm6skh2ic0k
Add tests.

* bzrlib/transport/http/_urllib.py:
(HttpTransport_urllib.has): Ignores 302 error code, it is already
handled.

* bzrlib/transport/http/_pycurl.py:
(PyCurlTransport.has): Set headers acquisition. Pass headers to
_curl_perform. Ignores 302 error code, it is already
handled.
(PyCurlTransport._get_full, PyCurlTransport._get_ranged): Pass
headers to _curl_perform.
(PyCurlTransport._post): Pass headers to _curl_perform.
(PyCurlTransport._set_curl_options): Do not follow redirections
anymore.
(PyCurlTransport._curl_perform): Handle redirections by raising

* bzrlib/tests/test_http.py:
(TestHTTPRedirections): Simplified.
(TestHTTPRedirections_pycurl): New class.

* bzrlib/tests/test_bzrdir.py:
(TestHTTPRedirectionLoop, TestHTTPRedirections_urllib,
TestHTTPRedirections_pycurl): New classes to test redirection
loops when opening bzrdirs.

* bzrlib/tests/HTTPTestUtil.py:
(HTTPServerRedirecting.redirect_to,
HTTPServerRedirecting.redirected_to_address): New methods.

* bzrlib/bzrdir.py:
(BzrDirMetaFormat1.probe_transport): Deleted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
179
179
        response = self._head(relpath)
180
180
 
181
181
        code = response.code
182
 
        # FIXME: 302 MAY have been already processed by the
183
 
        # redirection handler
184
 
        if code in (200, 302): # "ok", "found"
 
182
        if code == 200: # "ok",
185
183
            return True
186
184
        else:
187
 
            assert(code == 404, 'Only 200, 404 or may be 302 are correct')
 
185
            assert(code == 404, 'Only 200 or 404 are correct')
188
186
            return False
189
187
 
190
188