Hello,

The first patch (from Steinar H. Gunderson) adds two similar bugs, not
just one. The eval {} thing is also used in PrefetchUrl(), same as in
FetchUrl() (patched by Lorenzo Clemente).

Attached the full patch for "both" bugs, for version 1.1-2.1.

The squid-prefetch package should be updated, this is an old and quite
critical bug.

-- 
Daniel Dumitrache
--- /tmp/RnWVWA3144/squid-prefetch-1.1-2/squid-prefetch	2008-02-08 13:12:00.000000000 +0200
+++ /tmp/nanRZL3156/squid-prefetch-1.1-2/squid-prefetch	2008-09-01 23:30:59.000000000 +0300
@@ -144,10 +144,11 @@
 	local $SIG{ALRM} = sub { die "Error: Timeout fetching $url\n" };
 	alarm(3);
 
+	my ($code,$mesg,%hdrs, $http);
 	eval {
-		my $http = Net::HTTP->new(PeerHost => $ProxyHost, PeerPort => $ProxyPort, Host => $host, SendTE => 0, KeepAlive => 0);
+		$http = Net::HTTP->new(PeerHost => $ProxyHost, PeerPort => $ProxyPort, Host => $host, SendTE => 0, KeepAlive => 0);
 		$http->write_request("GET" => "http://$host$path";, "Accept" => "text/html", "Cache-Control" => "only-if-cached", "User-Agent" => "Squid-Prefetch");
-		my ($code,$mesg,%hdrs) = $http->read_response_headers();
+		($code,$mesg,%hdrs) = $http->read_response_headers();
 		print "\nfetch: $url: $code ($mesg)\n";
 		print "  $k  ->  $v\n" while (($k,$v) = each %hdrs);
 	};
@@ -222,10 +223,11 @@
 	local $SIG{ALRM} = sub { die "Error: Timeout fetching $url\n" };
 	alarm(3);
 
+	my ($code,$mesg,%hdrs, $http);
 	eval {
-		my $http = Net::HTTP->new(PeerHost => $ProxyHost, PeerPort => $ProxyPort, Host => $host, SendTE => 1, KeepAlive => 0);
+		$http = Net::HTTP->new(PeerHost => $ProxyHost, PeerPort => $ProxyPort, Host => $host, SendTE => 1, KeepAlive => 0);
 		$http->write_request("GET" => "http://$host$path";, "Accept" => "text/*", "User-Agent" => "Squid-Prefetch");
-		my ($code,$mesg,%hdrs) = $http->read_response_headers();
+		($code,$mesg,%hdrs) = $http->read_response_headers();
 		print "\nprefetch: $url: $code ($mesg)\n";
 #		print "  $k  ->  $v\n" while (($k,$v) = each %hdrs);
 	};

Reply via email to