in reply to Re: LWP::UserAgent adding unwanted TE header
in thread LWP::UserAgent adding unwanted TE header

Thanks for your reply. So the TE stuff is actually being added by the server because the message is HTTP/1.1? And the headers being sent by LWP::UserAgent client are actually correct? I am using the PHP function apache_request_headers() on a page on localhost to echo back the request headers.
  • Comment on Re^2: LWP::UserAgent adding unwanted TE header

Replies are listed 'Best First'.
Re^3: LWP::UserAgent adding unwanted TE header
by shmem (Chancellor) on Jul 05, 2006 at 12:20 UTC

    Uhm, no. It's not a server header (it's good to know where an RFC is, but to read it actually is far better :-) - it's a client header, and yes, the header is added by LWP because the request is HTTP/1.1. The server header would be Transfer-encoding, it would seem.

    The deflate,gzip value gets added if the Zlib library is installed. I can't see that this is somehow cofigurable for now, it's buried in LWP/Protocol/http (in _new_socket):

    local($^W) = 0; # IO::Socket::INET can be noisy my $sock = $self->socket_class->new(PeerAddr => $host, PeerPort => $port, Proto => 'tcp', Timeout => $timeout, KeepAlive => !!$conn_cache, SendTE => 1, $self->_extra_sock_opts($host, + $port), );
    Setting SendTE to 0 disables TE headers. The above config pseudo hash is passed to Net::HTTP->new it seems. If you get at the NET::HTTP object used by LWP::UserAgent, maybe you can disable sending TE headers..

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
      Thanks, editting SendTE to 0 manually in LWP/Protocol/http gets rid of the TE header for now. I will do some more reading and try to work out a more elegant solution. Thanks again!