Hi again! Had some more time to work on my W:M:F project. I installed the latest version today and it appears all my slowness/delay problems are fixed! Thanks for that! The whole thing runs way faster now and I don't have to ugly-hack the code.

My current problem is save_url isn't sending cookies with the GET request. I am get()ing a parent page then save_url a link to a large zip file in that page. The site *requires* cookies on all GETs, even for the zip, or it redirects to an error page.

I used wireshark to look at the traffic when I manually right-click and click save as in firefox vs. using W:M:F to save_url. Manually, the cookies get sent. save_url does *not* send the cookies (or referrer).

So I tried adding to the save_url code:
obj_Persist.persistFlags = obj_Persist.persistFlags | nsIWBP.PERSIST_FLAGS_FORCE_ALLOW_COOKIES;
after:
obj_Persist.persistFlags = flags | nsIWBP.PERSIST_FLAGS_FROM_CACHE;

As the mozilla docs seem to indicate that would do what I wanted. The cookies still do not get sent. I'm not sure why this doesn't work, unless the nsIWBP.PERSIST_FLAGS_FORCE_ALLOW_COOKIES option is broken. I checked and confirmed my Firefox/Gecko is new enough to support it, supposedly.

It makes sense to me that by default save_url should pass all cookies the site is expecting automatically, just as if you right-clicked and clicked save as manually.

Is there another approach I can take? Any ideas? I was thinking maybe pulling the cookies out and then passing them through manually into the obj_Persist.saveURI aExtraHeaders argument.

Thanks!


In reply to WWW::Mechanize::Firefox save_url doesn't send cookies by tcordes

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.