You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Ritcey, Benjamin" <Be...@tfn.com> on 1999/08/23 23:47:27 UTC
'Range: bytes=' request with starting byte greater than size of
f ile
Hi all,
I've poked around the list archives and the bug db and can't find an answer
to my problem.
version), I see:
If a syntactically valid byte-range-set includes at least one
byte-range-spec whose first-byte-pos is less than the current length of the
entity-body, or at least one suffix-byte-range-spec with a non-zero
suffix-length, then the byte-range-set is satisfiable. Otherwise, the
byte-range-set is unsatisfiable. If the byte-range-set is unsatisfiable, the
server SHOULD return a response with a status of 416 (Requested range not
satisfiable). Otherwise, the server SHOULD return a response with a status
of 206 (Partial Content) containing the satisfiable ranges of the
entity-body.
I take that to mean that if a byterange request has a starting byte that is
beyond the end of the requested file, it should return a 416 code. Apache
currently does not do this -- in this case, it returns the entire file.
An example (in this case, index.html is 2700 bytes long):
boddingtons:/> telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /index.html HTTP/1.1
Host: localhost
Range: bytes=2800-2900
Connection: close
HTTP/1.1 200 OK
Date: Mon, 23 Aug 1999 21:03:12 GMT
Server: Apache/1.3.9 (Unix) mod_perl/1.21
Last-Modified: Wed, 18 Aug 1999 20:51:03 GMT
ETag: "bad2-aec-37bb1cb7"
Accept-Ranges: bytes
Content-Length: 2796
Connection: close
Content-Type: text/html
<the whole of index.html returned here>
Am I missing something here? I see why this happens -- parse_byterange in
http_protocol.c sets *end=clength-1 and then returns 0 if *start > *end,
which will be true if the start is greater than the length of the file --
I'm just not sure if it's a feature or a bug =)
Thanks,
-b
Re: 'Range: bytes=' request with starting byte greater than size of f ile
Posted by Manoj Kasichainula <ma...@io.com>.
On Wed, Aug 25, 1999 at 10:51:17PM -0700, Dean Gaudet wrote:
> i think, in a nutshell, this is a difference between http 1.1 rev-01 and
> rev-02... rfc2068 and rfc2616... for example, code 416 isn't even in
> rfc2068.
I remember hearing during an IETF meeting that this status code annoys
some version of IE that has a bug in its range handling. Don't ask me
how I remember this; it must one of those random neuron firings that
tends to happen more often near 3am.
--
Manoj Kasichainula - manojk at io dot com - http://www.io.com/~manojk/
Re: 'Range: bytes=' request with starting byte greater than size of f ile
Posted by Dean Gaudet <dg...@arctic.org>.
i think, in a nutshell, this is a difference between http 1.1 rev-01 and
rev-02... rfc2068 and rfc2616... for example, code 416 isn't even in
rfc2068.
want to submit a patch for it? :)
Dean
On Mon, 23 Aug 1999, Ritcey, Benjamin wrote:
> Hi all,
>
> I've poked around the list archives and the bug db and can't find an answer
> to my problem.
>
> version), I see:
>
> If a syntactically valid byte-range-set includes at least one
> byte-range-spec whose first-byte-pos is less than the current length of the
> entity-body, or at least one suffix-byte-range-spec with a non-zero
> suffix-length, then the byte-range-set is satisfiable. Otherwise, the
> byte-range-set is unsatisfiable. If the byte-range-set is unsatisfiable, the
> server SHOULD return a response with a status of 416 (Requested range not
> satisfiable). Otherwise, the server SHOULD return a response with a status
> of 206 (Partial Content) containing the satisfiable ranges of the
> entity-body.
>
> I take that to mean that if a byterange request has a starting byte that is
> beyond the end of the requested file, it should return a 416 code. Apache
> currently does not do this -- in this case, it returns the entire file.
>
> An example (in this case, index.html is 2700 bytes long):
>
> boddingtons:/> telnet localhost 80
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> GET /index.html HTTP/1.1
> Host: localhost
> Range: bytes=2800-2900
> Connection: close
>
> HTTP/1.1 200 OK
> Date: Mon, 23 Aug 1999 21:03:12 GMT
> Server: Apache/1.3.9 (Unix) mod_perl/1.21
> Last-Modified: Wed, 18 Aug 1999 20:51:03 GMT
> ETag: "bad2-aec-37bb1cb7"
> Accept-Ranges: bytes
> Content-Length: 2796
> Connection: close
> Content-Type: text/html
>
> <the whole of index.html returned here>
>
> Am I missing something here? I see why this happens -- parse_byterange in
> http_protocol.c sets *end=clength-1 and then returns 0 if *start > *end,
> which will be true if the start is greater than the length of the file --
> I'm just not sure if it's a feature or a bug =)
>
> Thanks,
>
> -b
>