Skip to content
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

fix: http redirect for /piece/ in booster-http #956

Merged
merged 2 commits into from
Nov 16, 2022
Merged

fix: http redirect for /piece/ in booster-http #956

merged 2 commits into from
Nov 16, 2022

Conversation

LexLuthr
Copy link
Collaborator

$ curl -v "http://localhost:7777/piece?payloadCid=QmbSLYv6EbbctX5MCuUR6PLxh2sCZLVg5JsUsEMy86tXD2&format=car" --output /tmp/out.car
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 127.0.0.1:7777...

  • TCP_NODELAY set
  • Connected to localhost (127.0.0.1) port 7777 (#0)

GET /piece?payloadCid=QmbSLYv6EbbctX5MCuUR6PLxh2sCZLVg5JsUsEMy86tXD2&format=car HTTP/1.1
Host: localhost:7777
User-Agent: curl/7.68.0
Accept: /

  • Mark bundle as not supporting multiuse
    < HTTP/1.1 301 Moved Permanently
    < Content-Type: text/html; charset=utf-8
    < Location: /piece/?payloadCid=QmbSLYv6EbbctX5MCuUR6PLxh2sCZLVg5JsUsEMy86tXD2&format=car
    < Date: Wed, 16 Nov 2022 08:45:17 GMT
    < Content-Length: 115
    <

By default, mux handler removes the succeeding "/" and incorrect URL format is also served after a redirect. A strict client side check reveals the problem.

Copy link
Contributor

@dirkmc dirkmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of suggestions to clean up the code, but overall looks good to me 👍

Feel free to merge when the cleanup is done.

cmd/booster-http/http_test.go Outdated Show resolved Hide resolved
cmd/booster-http/http_test.go Outdated Show resolved Hide resolved
@LexLuthr LexLuthr merged commit bbf3029 into main Nov 16, 2022
@nonsense nonsense deleted the fix/http-url branch January 17, 2023 15:29
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

Successfully merging this pull request may close these issues.

2 participants