Re: Bug in Netscape-Proxy/2.52 - how avoid ?

Gisle Aas (gisle@aas.no)
07 Apr 2000 15:20:17 +0200


"BAZLEY, Sebastian" <Sebastian.BAZLEY@sema.co.uk> writes:

> When using the a Netscape proxy server to fetch (GET) a file, if the file
> has been cached, then part of the HTTP headers get stored with the file.
> [This causes problems with binary files!]
> 
> Using debug shows the following header lines:
> 
> [snip]
> Warning: 10 host:port "Remote server was not contacted, document may be out
> of date"
> Last checked: Mon Apr 03 17:49:01 2000
> Server: Netscape-Proxy/2.52
> Content-Length: nnn
> Content-Type: etc
> <blank line>
> 
> All the lines starting with "Last checked:" are copied to the output file.
> 
> Inspection of the LWP code suggests that the problem is the space in the
> "Last checked:" header line - presumably this is not a valid HTTP header.
> 
> Temporarily changing the regular expression in HTTP.PM to allow a space
> fixes the problem, but strikes me as a kludge.
> 
> Can anyone advise the best course of action (excluding fixing the proxy
> server!) ?

I have had this patch pending for a while.  It would probably help here.

Regards,
Gisle


Index: lib/LWP/Protocol/http.pm
===================================================================
RCS file: /home/cvs/aas/perl/mods/libwww-perl/lib/LWP/Protocol/http.pm,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -p -u -r1.47 -r1.48
--- http.pm	1999/11/04 20:31:21	1.47
+++ http.pm	2000/04/07 13:09:54	1.48
@@ -1,5 +1,5 @@
 #
-# $Id: http.pm,v 1.47 1999/11/04 20:31:21 gisle Exp $
+# $Id: http.pm,v 1.48 2000/04/07 13:09:54 gisle Exp $
 
 package LWP::Protocol::http;
 
@@ -199,19 +199,10 @@ sub request
 		if ($line =~ /^([a-zA-Z0-9_\-.]+)\s*:\s*(.*)/) {
 		    $response->push_header($key, $val) if $key;
 		    ($key, $val) = ($1, $2);
-		} elsif ($line =~ /^\s+(.*)/) {
-		    unless ($key) {
-			$response->header("Client-Warning" =>
-					 => "Illegal continuation header");
-			$buf = "$save$buf";
-			last;
-		    }
+		} elsif ($line =~ /^\s+(.*)/ && $key) {
 		    $val .= " $1";
 		} else {
-		    $response->header("Client-Warning" =>
-				      "Illegal header '$line'");
-		    $buf = "$save$buf";
-		    last;
+		    $response->push_header("Client-Bad-Header-Line" => $line);
 		}
 	    }
 	    $response->push_header($key, $val) if $key;