-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
netops: handle intact query parameters in service_suffix removal #5339
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I honestly find it very hard to reason about this, but this is no fault of yours. We do have tests in "tests/network/redirect.c" that are supposed to exercise this function. Would you feel up to the task of adding some tests in there that show what exact scenario you're fixing? Feel free to say "no" here and I'll try to come up with some tests myself based on your description.
Some servers leave the query parameters intact in the Location header when responding with a redirect. The service_suffix removal check as written assumed that the server removed them. Handle both cases. Along with PR libgit2#5325, this fixes libgit2#5321. There are two new tests. The first already passed; the second previously failed.
That's kind, but I'll take the fault. I've added more documentation in the code.
Thanks for the pointer. I hadn't found those, only the tests against live servers. I've added two tests. The first already passed; the second previously failed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks a lot for your amendments! Tests look good to me and the new comments definitely help.
|
||
/* Check for a redirect without query parameters, like "/newloc/info/refs" */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, these comments make things much clearer to me!
Some servers leave the query parameters intact in the
Location header when responding with a redirect.
The service_suffix removal check as written assumed
that the server removed them.
Handle both cases.
Along with PR #5325, this fixes #5321.
Please review skeptically; my C is extremely rusty.