Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: LWP::UserAgent adding unwanted TE header

by shmem (Chancellor)
on Jul 05, 2006 at 10:57 UTC ( [id://559300]=note: print w/replies, xml ) Need Help??


in reply to LWP::UserAgent adding unwanted TE header

These are not headers LWP adds deliberately. These are headers returned from the remote server according to HTTP/1.1 <-- that's bull.

TE headers are client headers (see RFC2616 for the full specification). I confused them with Transfer-encoding ...

Uhm, let's see...

--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}
  • Comment on Re: LWP::UserAgent adding unwanted TE header

Replies are listed 'Best First'.
Re^2: LWP::UserAgent adding unwanted TE header
by Anonymous Monk on Jul 05, 2006 at 11:11 UTC
    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.

      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!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://559300]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-26 08:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found