httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Becker <>
Subject Byte Range Difficulty
Date Tue, 08 Apr 2003 20:32:49 GMT
I have an application which depends on the Range header. When testing 
with apache 2, I ran into a problem.

This is good:

GET /test/ad1s_0001.fbs?u=none&0.6456 HTTP/1.1
Accept: */*
Range: bytes=0-6455

HTTP/1.1 206 Partial Content
Date: Tue, 08 Apr 2003 20:09:04 GMT
Server: Apache/2.0.40 (Red Hat Linux)
Last-Modified: Mon, 10 Mar 2003 19:54:40 GMT
ETag: "2890010-f486-9af66000"
Accept-Ranges: bytes
Content-Length: 6456
Content-Range: bytes 0-6455/62598
Connection: close
Content-Type: image/tiff

But later I send this:

GET /test/ad1s_0001.fbs?u=none&0.6456 HTTP/1.1
Accept: */*
Range: bytes=0-6455
If-Modified-Since: Mon, 10 Mar 2003 19:54:40 GMT

And get this:

HTTP/1.1 416 Requested Range Not Satisfiable
Date: Tue, 08 Apr 2003 20:09:01 GMT
Server: Apache/2.0.40 (Red Hat Linux)
Content-Length: 384
Connection: close
Content-Type: text/html; charset=iso-8859-1

As you can see from the Content-Range header in the first response, the 
file is 62598 bytes long so asking for the first 6456 bytes is a valid 
request and it works with 1.3. Pardon me for not testing with the latest 
devopment version but I looked for any resolved bugs about this and 
could not find any.

In /modules/http/http_protocol.c I found the code generating the error. 
It's in the ap_byterange_filter. I don't have a deep understanding of 
apache but I think that ap_byterange_filter is being called after a 
filter for If-Modified-Since and ap_byterange_filter is choking on the 
Content-Length which is smaller than the requested range. Perhaps a fix 
would be for ap_byterange_filter to do nothing if it finds the current 
response status set to 304.

My alternative to getting this resolved would be to send a HEAD request 
to verify the cache timestamp which would add an unnecessary round trip 
to the process or treat 416 like a 304 in my app (ickkk!)

The first thing I did was to pour over the specs but could not find any 
reasoning for this behavior.

Thanks for your help!

Scott Becker
Builders Exchange of Washington, Inc.

View raw message