empty headers
Priebe, Jason (priebe@wral-tv.com)
Fri, 26 Nov 1999 10:26:35 -0500
I came across another poorly formed response that LWP doesn't
seem to handle very well. Here's an example:
----------------------------------------------------------------------
> telnet www.cemacity.org 80
Trying 38.201.123.205...
Connected to cemacity.org.
Escape character is '^]'.
HEAD / HTTP/1.0
HTTP/1.1 302 Object moved
Server: Microsoft-IIS/4.0
Date: Fri, 26 Nov 1999 10:09:14 GMT
: 9207358000
Location: http://204.245.190.25/default.cfm
Content-Type: text/html
Set-Cookie: ASPSESSIONIDGQGQGRWL=LNLFLAGBKEIGCCMPBLCJJJGN; path=/
Cache-control: private
Connection closed by foreign host.
----------------------------------------------------------------------
Notice the response header ": 920735800". This causes LWP to not read
the rest of the headers. It reports "Client-Warning: Redirect loop
detected"
(I guess because it doesn't read the Location header).
I am attaching a patch to LWP/Protocol/http.pm that will allow it to
read such poorly formed headers. I'm not aware of the implications
of this. Will allowing these "empty headers" have a negative impact
on other functions within LWP?
197,199c197
< # patch by Jason Priebe <priebe@wral-tv.com> to allow
< # poorly formed headers of the form ": $val" (missing $key)
< if ($line =~ /^([a-zA-Z0-9_\-.]*)\s*:\s*(.*)/) {
---
> if ($line =~ /^([a-zA-Z0-9_\-.]+)\s*:\s*(.*)/) {
Jason Priebe
WRAL OnLine
http://www.wral-tv.com/