httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Will Lowe <>
Subject 1.x: byte-range with ErrorDocuments returns incorrect status code
Date Wed, 25 Feb 2004 21:57:45 GMT
It looks like byte-range requests on non-existant files returns 206
instead of 404 if ErrorDocument is set.  This Debian's testing and
stable releases, running on sparc and i386 respectively.  I have this
in my config on my 1.x server:

Alias /errordocs/404.html /etc/apache/404.html
ErrorDocument 404 /errordocs/404.html

Normal requests work as expected: 

harpo@alley:~$ curl -si
HTTP/1.1 404 Not Found

... followed by the error document I configured. But byte-range
requests return 206 instead of 404:

harpo@alley:~$ curl -r 10-20 -si
HTTP/1.1 206 Partial Content

And it returns me bytes 10-20 of the ErrorDocument.  It looks to me
like this is because r->status gets overwritten to 206 by
ap_set_byterange() in the subrequest.

Here are a coupla thoughts I had on possible fixes (I need this badly
enough that I will code and test a fix if necessary):

* remove the Range: header from the subrequest inside ap_die(),
thereby making this NOT a byte-range request anymore.

* have ap_set_byterange() only set r->status if r->status isn't set
(how do we determine "isn't set"?)

* have ap_set_byterange() only set r->status if r->status isn't set
to a 2xx or 3xx code already

Any thoughts?


View raw message