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


In reply to "Bad" http headers in LWP::UserAgent by adamm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.