adamm has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I am building my first perl App and got problem i cannot resolve.
My app sends an http request to the server using LWP::UserAgent module
I set my headers in my code, but sniffer shows something different.
The code:
my $ua = LWP::UserAgent->new(); my $req= HTTP::Request->new('POST', $url); $req->content_type('text/xml, charset=utf-8'); $req->content($postdata); $req->header('SOAPAction' => '"loginRequest"'); $req->header('Connection' => 'keep-alive'); $req->header('User-Agent' => $App.' '.$Version); $req->header('Accept text/xml' => 'multipart/related'); my $response = $ua->prepare_request($req); print $req->as_string; $response = $ua->send_request($req);
The print instruction near the bottom shows correct headers, but wireshark exposes something different.
print output:
POST http://192.168.2.46:7191/soap Connection: keep-alive User-Agent: ProxyApp 1.00 Content-Type: text/xml, charset=utf-8 Accept Text/Xml: multipart/related SOAPAction: "loginRequest"
Wireshark output:
POST /soap HTTP/1.1 TE: deflate,gzip;q=0.3 Connection: keep-alive, TE, close Host: 192.168.2.46:7191 User-Agent: ProxyApp 1.00 Content-Type: text/xml, charset=utf-8 Accept Text/Xml: multipart/related SOAPAction: "loginRequest" Content-Length: 369
I would like to get rid of the 'TE' header, have 'Connection' value "keep-alive" only.
I am not shure if that 'Accept Text/Xml' should be 'Accept text/xml'
I am using perl v5.12.3
Thanks in advance
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: "Bad" http headers in LWP::UserAgent
by MidLifeXis (Monsignor) on Sep 19, 2012 at 12:58 UTC | |
|
Re: "Bad" http headers in LWP::UserAgent
by tobyink (Canon) on Sep 19, 2012 at 13:24 UTC |