8000 308 Redirects are not followed · Issue #4675 · libgit2/libgit2 · GitHub
[go: up one dir, main page]

Skip to content
8000

308 Redirects are not followed #4675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ZanderBrown opened this issue Jun 8, 2018 · 7 comments
Closed

308 Redirects are not followed #4675

ZanderBrown opened this issue Jun 8, 2018 · 7 comments

Comments

@ZanderBrown
Copy link
Contributor

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

@carlosmn
Copy link
Member

For reference 308 Permanent Redirect seems to be a newer code introduced to work around some libraries misusing 301 Moved Permanently. Mozilla's documentation about the latter suggests using 308 for POST requests.

@ZanderBrown
Copy link
Contributor Author

That's more about keeping the verb the same, 308 & GET is perfectly valid

@pks-t
Copy link
Member
pks-t commented Oct 5, 2018

Hi @ZanderBrown, and sorry for not providing more feedback earlier. The fix for this issue should be trivially to do, as you've also already found the correct location where to implement it. Do you wish to give it a try yourself after all this time? Otherwise I'd take this over and implement it myself.

@ZanderBrown
Copy link
Contributor Author

I've not built libgit2 before so it's probably faster if you do it

@pks-t
Copy link
Member
pks-t commented Oct 5, 2018

I'm just trying to lure you into the project ;) So I'm not particularly concerned about how fast this is getting resolved -- if you feel like you'd be interested to give it a try I'd be more than happy to leave it to you.

@ZanderBrown
Copy link
Contributor Author

You win :-)

@carlosmn
Copy link
Member

Fixed via #4848

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0