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

Should not return 416 for empty files when Range includes 0 #9238

Closed
3 tasks done
thattommyhall opened this issue Aug 30, 2022 · 2 comments · Fixed by #9241
Closed
3 tasks done

Should not return 416 for empty files when Range includes 0 #9238

thattommyhall opened this issue Aug 30, 2022 · 2 comments · Fixed by #9241
Assignees
Labels
kind/bug A bug in existing code (including security flaws) P2 Medium: Good to have, but can wait until someone steps up

Comments

@thattommyhall
Copy link
Member

Checklist

Installation method

ipfs-update or dist.ipfs.tech

Version

Kubo version: 0.15.0
Repo version: 12
System version: amd64/linux
Golang version: go1.18.5


### Config

```json
default

Description

@aschmahmann reported seeing this on our public gateway

curl https://dweb.link/ipfs/bafkqaaa  
invalid range: failed to overlap

It seems that the error is induced by us having enabled fragment caching and therefore adding a header "Range: bytes=0-1048575" to any requests that dont already have them (which is common practice)

We can induce the behaviour locally with:

❯ curl localhost:8080/ipfs/bafkqaaa -H "Range: bytes=0-1048575"
invalid range: failed to overlap

❯ curl -IL localhost:8080/ipfs/bafkqaaa -H "Range: bytes=0-1048575"
HTTP/1.1 416 Requested Range Not Satisfiable
...

My reading of the spec, particularly

"For byte ranges, failing to overlap the current extent means that the first-byte-pos of all of the byte-range-spec values were greater than the current length of the selected representation"

(if it means strictly greater than and not greater than or equal) is that was more correct to serve a 203 or maybe 200 there?

@thattommyhall thattommyhall added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Aug 30, 2022
@welcome
Copy link

welcome bot commented Aug 30, 2022

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment.
Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

Finally, remember to use https://discuss.ipfs.io if you just need general support.

@Jorropo Jorropo self-assigned this Aug 30, 2022
@Jorropo Jorropo added P1 High: Likely tackled by core team if no one steps up and removed need/triage Needs initial labeling and prioritization labels Aug 30, 2022
@BigLep BigLep added P2 Medium: Good to have, but can wait until someone steps up and removed P1 High: Likely tackled by core team if no one steps up labels Aug 31, 2022
@Jorropo
Copy link
Contributor

Jorropo commented Aug 31, 2022

IMO This is an issue with go and null files should be 200 if the range start at 0 (because handling the range is more expensive that just giving me the file): golang/go#54794

I'll implement an override inside kubo while we wait to see how golang/go#54794 develop.

Jorropo added a commit to Jorropo/go-ipfs that referenced this issue Aug 31, 2022
Jorropo added a commit to Jorropo/go-ipfs that referenced this issue Aug 31, 2022
Jorropo added a commit to Jorropo/go-ipfs that referenced this issue Aug 31, 2022
Jorropo added a commit that referenced this issue Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) P2 Medium: Good to have, but can wait until someone steps up
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants