Skip to content

Range requests do not work when full content is smaller than the requested Range #604

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

Open
cmosa opened this issue Jun 7, 2012 · 5 comments

Comments

@cmosa
Copy link

cmosa commented Jun 7, 2012

When a GET request has a Range bigger than the actual content to be sent in the response, Restlet gives a wrong Content-Length header. The Content-Range header is correct.

Example HTTP Request:

GET /mm/A2LUIXJTVSN7YU HTTP/1.1
host: dummy.com
Accept: */*
Accept-Encoding: deflate, gzip
Range: bytes=0-40960
Connection: Close

HTTP/1.1 206 Partial Content
Accept-Ranges: bytes
Content-Range: bytes 0-40960/1569
Content-Type: text/html;charset=UTF-8
Date: Thu, 07 Jun 2012 18:41:19 GMT
Server: Restlet-Framework/2.0.9
Vary: Accept-Charset,Accept-Encoding,Accept-Language,Accept
Content-Length: 40961
Connection: Close
@cmosa
Copy link
Author

cmosa commented Jun 7, 2012

Issue was found while working with the facebook opengraph features. As facebook is using a Range request, it does not work if the opengraph object is served by a Restlet application.
I used getRangeService().setEnabled(false) as a workaround

Also, I don't know if it is facebook's HTTP implementation that is wrong: is it accepted to ask for a Range without first making a HEAD request to know the full Content-Length?

@mintrigue
Copy link

I came across this same issue. I believe it is a bug in restlet because the content-length is supposed to be the length of the content being returned.

I think this can be fixed by updating BioUtil.getAvailableSize().

@mintrigue
Copy link

I added a pull request for this...noted in issue #609

@thboileau
Copy link
Contributor

I think also this is a bug. Actually there are two bugs since the "Content-Length" is wrong and the "Content-Range" also (see RFC 2616 chapter 14.16 Content-Range : A byte-content-range-spec with a [...] instance-length value is less than or equal to its last-byte-pos value is invalid).

@jlouvel
Copy link
Member

jlouvel commented Aug 18, 2012

Agreed, we need to fix both issues.

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

No branches or pull requests

4 participants