Hello Monks,

I'm using WWW::Mechanize to duplicate various HTTP requests.

Since I want the request headers to be identical with my browser's headers, I modify them using add_header(). Everything works as intended except for some header named "TE" showing up in every request.

TE: deflate,gzip;q=0.3

I tried to get rid of it (see below) without success and I'm sort of confused why Mechanize enforces this header when my browser(s) don't even use it.
require WWW::Mechanize; my $mech = WWW::Mechanize->new( agent => 'Mozilla/4.0 (compatible; MSI +E 6.0; Windows NT 5.1)', timeout => 60, stack_depth => 1, autocheck = +> 0); $mech->add_header( Accept => 'text/xml,application/xml,application/xht +ml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'); $mech->add_header( "Accept-Language" => 'en-us;q=0.8,en;q=0.5,de-de;q= +0.3'); $mech->add_header( "Accept-Charset" => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7 +'); $mech->add_header( Connection => 'keep-alive'); $mech->add_header( "Keep-Alive" => 10); $mech->add_header( TE => undef);

I'd appreciate any help to get around this issue, preferably without hacking the module itself.

Thanks,
Björn

In reply to Undeleteable header in WWW::Mechanize by javahater

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.