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

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-09-13 00:50:28 UTC
  • mfrom: (7096.1.2 fix-git-reidrecits)
  • Revision ID: breezy.the.bot@gmail.com-20180913005028-4pe8c0ufwexyla0i
Fix HTTP redirects for Git repositories.

Merged from https://code.launchpad.net/~jelmer/brz/fix-git-reidrecits/+merge/354534

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
        base_url, _ = urlutils.split_segment_parameters(transport.external_url())
149
149
        url = urlutils.join(base_url, "info/refs") + "?service=git-upload-pack"
150
150
        from ..transport.http import Request
151
 
        headers = {"Content-Type": "application/x-git-upload-pack-request"}
 
151
        headers = {"Content-Type": "application/x-git-upload-pack-request",
 
152
                   "Accept": "application/x-git-upload-pack-result",
 
153
                   }
152
154
        req = Request('GET', url, accepted_errors=[200, 403, 404, 405],
153
155
                      headers=headers)
154
156
        (scheme, user, password, host, port, path) = urlutils.parse_url(req.get_full_url())
158
160
        elif host == "bazaar.launchpad.net":
159
161
            # Don't attempt Git probes against bazaar.launchpad.net; pad.lv/1744830
160
162
            raise bzr_errors.NotBranchError(transport.base)
161
 
        req.follow_redirections = True
162
163
        resp = transport._perform(req)
163
164
        if resp.code in (404, 405):
164
165
            raise bzr_errors.NotBranchError(transport.base)