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 content-length calculation on range requests #228

Merged
merged 2 commits into from Mar 9, 2022

Conversation

moumar
Copy link
Contributor

@moumar moumar commented Mar 8, 2022

hello,

content-length response header on range requests should represent the length of the returned range, not the length of the whole file.

more explanations here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests

Best regards.

Copy link
Member

@davidpdrsn davidpdrsn left a comment

Choose a reason for hiding this comment

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

Oh good catch! I wonder how we missed this 🤔

Some tests for this would be great!

@MarcusGrass
Copy link
Collaborator

I see there are a few tests running on both head-requests and range-requests checking the content-length and that you fixed the test that should return something other than the full file size. It seems that I both wrote a bug and a bugged test to go with it. Really nice catch, thank you!

@adumbidiot
Copy link

I think this closes #197. I’ll try to test it out later

Copy link
Member

@davidpdrsn davidpdrsn left a comment

Choose a reason for hiding this comment

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

I think this looks good. Will wait for @adumbidiot to report back before merging.

@adumbidiot
Copy link

Just tested, this fixes #197

@davidpdrsn
Copy link
Member

Great! I think I'll backport this to 0.2.x tomorrow while we work on 0.3.

@davidpdrsn davidpdrsn merged commit 053f5a5 into tower-rs:master Mar 9, 2022
davidpdrsn added a commit that referenced this pull request Mar 11, 2022
* fix content-length calculation on range requests

* changelog

Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
davidpdrsn added a commit that referenced this pull request Mar 11, 2022
* fix content-length calculation on range requests

* changelog

Co-authored-by: David Pedersen <david.pdrsn@gmail.com>

Co-authored-by: moumar <guillaume.pierronnet@protonmail.com>
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.

None yet

4 participants