Skip to content

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

Description

@cmosa

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

Activity

  1. cmosa commented on Jun 7, 2012

    @cmosa
    Author

    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?

  2. mintrigue commented on Jun 14, 2012

    @mintrigue

    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().

  3. mintrigue commented on Jun 14, 2012

    @mintrigue

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

  4. thboileau commented on Jun 20, 2012

    @thboileau
    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).

  5. jlouvel commented on Aug 18, 2012

    @jlouvel
    Collaborator

    Agreed, we need to fix both issues.

  6. modified the milestones: , on Feb 6, 2014
  7. added and removed on Feb 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions