Skip to content

308 Redirects are not followed #4675

@ZanderBrown

Description

@ZanderBrown

Reproduction steps

Try to clone a GitLab repository like https://gitlab.com/esodan/gresg/ (including the final / and without .git) - I used gnome-builder to do this

Expected behaviour

The repository is cloned after any necessary redirects

Actual behaviour

Clone fails with error quoting status 308

Version of libgit2 (release number or SHA1)

That used in 3.29.2-18-gb86e3ec flatpak-nightly (not sure what that links to) but should affect all versions

Operating system(s) tested

Fedora 28/flatpak

A 308 is defined as:

308 Permanent Redirect (RFC 7538) The request and all future requests should be repeated using another URI. 307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP method to change. So, for example, submitting a form to a permanently redirected resource may continue smoothly.

So basically it should be followed in the same way as 301, 302, 303 & 307

if ((parser->status_code == 301 ||
parser->status_code == 302 ||
(parser->status_code == 303 && get_verb == s->verb) ||
parser->status_code == 307) &&

Originally reported @ GNOME Builder

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions