Hello,

>From the code below, I'm expecting the following headers:
  Host: www.yahoo.com
  User-Agent: Squid 3.92

But I'm getting the following (when I use a sniffer):
  TE: deflate,gzip;q=0.3
  Connection: TE, close
  Host: www.yahoo.com
  User-Agent: Squid 3.92

Any idea how I can kill the "TE" and "Connection" headers? My use of "remove_header" 
doesn't seem to do any good...

thanks,
Phil

----

#!/usr/local/bin/perl

use strict;
use warnings;
my $url = 'http://www.yahoo.com/';

use LWP::UserAgent; 
use HTTP::Request; 
use HTTP::Response; 

my $ua = LWP::UserAgent->new(); 
$ua->agent("Squid 3.92"); 
$ua->proxy(['http', 'ftp'], 'http://localhost:8888/');

my $headers = HTTP::Headers->new;
$headers->remove_header('Connection');

print $headers->as_string;

my $req = HTTP::Request->new(GET => $url, $headers); 

my $response = $ua->request($req);
if ($response->is_error()) {
     printf " %s\n", $response->status_line;
 } else {
     my $count;
     my $bytes;
     my $content = $response->content();
     $bytes = length $content;
     $count = ($content =~ tr/\n/\n/);
     printf "%s (%d lines, %d bytes)\n", $response->title(), $count, $bytes; }

Reply via email to