[squid-users] response code 416 when Request-Range is in the header

From: Robert Dahlem <Robert.Dahlem@dont-contact.us>
Date: Mon, 15 Jul 2002 17:59:29 +0200

Hi,

I'm quite unsure if this is related to Squid or to Apache so please
forgive the crossposting.

My configuration consists of Squid 2.4STABLE7 and httpd 2.0.39.

Users configure their browsers to use squid as proxy, squid forwards
requests to httpd. Both Squid und httpd are on the same machine, users
are in the same LAN.

Users are complainig they get incomplete html documents. A little
investigation showed that this is almost always related to response code
416 ("range not satisfiable").

httpd logs:

[15/Jul/2002:14:35:11 +0200]
   "GET /organisation/formflow/forms/forms_wp.html HTTP/1.0" 304 0
[15/Jul/2002:14:35:11 +0200]
   "GET /organisation/formflow/forms/forms_wp.html HTTP/1.0" 416 384

First answer was "not modified", second was "range not satisfiable".

BTW: Whats does 384 mean in this case?

To investigate further, I wrote myself a little program which listens on
a port and pipes requests/replies between the client and Squid as well
as between Squid and httpd while logging the incoming requests (netcat
probably could to the trick also).

What comes in at Squid's side is this (some data obscured to protect the
innocent):

First request:

GET http://www.xxx.xxx/xxx/forms/forms_wp.html HTTP/1.0
If-Modified-Since: Mon, 15 Jul 2002 12:01:18 GMT; length=5992
Referer: http://www.xxx.xxx/xxx/forms/auswahllistekurz.html
Proxy-Connection: Keep-Alive
User-Agent: Mozilla/4.75 [de]C-CCK-MCD (WinNT; U)
Host: www.xxx.xxx
Accept: image/gif, image/x-xbitmap, image/jpeg, [...], image/png, */*
Accept-Encoding: gzip
Accept-Language: de,en
Accept-Charset: iso-8859-1,*,utf-8

Second request:

GET http://www.xxx.xxx/xxx/forms/forms_wp.html HTTP/1.0
Referer: http://www.xxx.xxx//forms/auswahllistekurz.html
Proxy-Connection: Keep-Alive
User-Agent: Mozilla/4.75 [de]C-CCK-MCD (WinNT; U)
Range: bytes=985-
Request-Range: bytes=985-
Host: www.xxx.xxx
Accept: image/gif, image/x-xbitmap, image/jpeg, [...], image/png, */*
Accept-Encoding: gzip
Accept-Language: de,en
Accept-Charset: iso-8859-1,*,utf-8

What comes in at httpd's side is this:

First request:

GET /xxx/forms/forms_wp.html HTTP/1.0
If-Modified-Since: Mon, 15 Jul 2002 12:01:18 GMT
Referer: http://www.xxx.xxx/xxx/forms/auswahllistekurz.html
User-Agent: Mozilla/4.75 [de]C-CCK-MCD (WinNT; U)
Accept: image/gif, image/x-xbitmap, image/jpeg, [...], image/png, */*
Accept-Encoding: gzip
Accept-Language: de,en
Accept-Charset: iso-8859-1,*,utf-8
Via: 1.0 squidhost.xxx.xxx:8081 (Squid/2.4.STABLE7)
X-Forwarded-For: nnn.nnn.nnn.nnn
Host: www.xxx.xxx
Cache-Control: max-age=259200
Connection: keep-alive

Second request:

GET /xxx/forms/forms_wp.html HTTP/1.0
If-Modified-Since: Mon, 15 Jul 2002 12:01:18 GMT
Referer: http://www.xxx.xxx/xxx/forms/auswahllistekurz.html
User-Agent: Mozilla/4.75 [de]C-CCK-MCD (WinNT; U)
Range: bytes=985-
Request-Range: bytes=985-
Accept: image/gif, image/x-xbitmap, image/jpeg, [...], image/png, */*
Accept-Encoding: gzip
Accept-Language: de,en
Accept-Charset: iso-8859-1,*,utf-8
Via: 1.0 squidhost.xxx.xxx:8081 (Squid/2.4.STABLE7)
X-Forwarded-For: nnn.nnn.nnn.nnn
Host: www.xxx.xxx
Cache-Control: max-age=259200
Connection: keep-alive

The requested document (forms_wp.html) has exactly 5992 of length, so it
should be no problem to send a range beginning with byte 985.

In the second request we can see Squid inserts "If-Modified-Since" into
the header. Ok, makes sense: no need to fetch the document when it's not
modified.

What I don't understand:

- Why the heck isn't Netscape satisfied with "not modified" and shuts up
but instead requests a byte range of the same document in the same
second?

- Why doesn't httpd simply replies with "not modified" to the second
request? (Ok, may have to do with "Request-Range". I'm not to deep in
the gory details of the protocol).

- If there is a reason not to answer with "not modified": Why does httpd
answer with "range not satisfiable" when it could happily transfer bytes
985-5992?

According to the CHANGES document there has been a change to httpd
2.0.37 by Justin Erenkrantz:

   Fix byterange requests from returning 416 when using dynamic data
   (such as filters like mod_include).

Wild speculation: httpd creates the answer "not modified" and tries to
transfer this answer beginning with byte 985. The answer is shorter than
985 bytes, so this is interpreted as out of range.

Could anybody please enlighten me? TIA.

Regards,
        Robert

-- 
Robert.Dahlem@siemens.com
Siemens Business Services - FS GF KORDOBA-Outsourcing
Tel: +49-69-797-6530  Fax: +49-69-797-6599
----------------------------------------------------------------------
Sent using PMMail (http://www.pmmail2000.com) - fast, decent, email
software; far better than Outlook. Try it sometime.
Received on Mon Jul 15 2002 - 09:59:35 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:09:15 MST