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

Why is size required #16

Closed
nicolasroger17 opened this issue Oct 26, 2017 · 2 comments
Closed

Why is size required #16

nicolasroger17 opened this issue Oct 26, 2017 · 2 comments
Labels

Comments

@nicolasroger17
Copy link

nicolasroger17 commented Oct 26, 2017

Hi,
I'm looking at your library to parse the range http header.
And I was wondering why you are making the size a required field, even though it is not part of the header.
A range is supposed to be like this:

Range: <unit>=<range-start>-
Range: <unit>=<range-start>-<range-end>
Range: <unit>=<range-start>-<range-end>, <range-start>-<range-end>
Range: <unit>=<range-start>-<range-end>, <range-start>-<range-end>, <range-start>-<range-end>

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range

I've tried to go around it by setting size to Infinity, but then when I use this format of header:

Range: bytes=10-

then it returns end: Infinity instead of null.

I've read the comment here: https://github.com/expressjs/express/blob/b97faff6e2aa4d34d79485fe4331cb0eec13ad57/lib/request.js#L188
But if you look at these simple examples:
https://stackoverflow.com/questions/8293687/sample-http-range-request-session#answer-8507991
The client is only sending the range, without any content-length.

Or do you mean that in order to parse the range, the server should get the size of the file, given that he will need it to correctly format the content-range header in the response.

@dougwilson
Copy link
Contributor

dougwilson commented Jan 15, 2018

Hi @nicolasroger17 unfortunately the original author is no longer around, and I don't know the reasoning to why the current API. There are certainly a lot of folks using the current API, though that doesn't mean it cannot be changed with a major version bump (and usually assessing what it would change in the existing uses so a migration doc can be written up).

Sorry I don't have the answer for you. Since it' been a few months, it is unlikely the author will answer your question, so I don't want to just leave your issue open indefinately.

Or do you mean that in order to parse the range, the server should get the size of the file, given that he will need it to correctly format the content-range header in the response.

Correct: "[...] where size is the maximum size of the resource." 👍

@nicolasroger17
Copy link
Author

nicolasroger17 commented Jan 15, 2018

Thanks for the reply, @dougwilson we can close it np

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

No branches or pull requests

2 participants