Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I think you could do it as an HTTP Proxy. Cookies travel in the header so a proxy should be able to capture and add cookies at will.


    • How do the user-agents get access to them? Getting the cookies is not the hard part---finding them later is.

      The major problem is that a lot of browsers do it in memory. They read their cookies file, keep it in memory, do stuff, and rewrite it on exit. Once the browser starts up, it has all the cookies it is going to get from anything other than its own requests.
      • Web browsers are have builtin HTTP Proxy support. Just open up your preferences and point your browser at the proxy address. Then all your HTTP requests flow through the proxy.


        • ... and the proxy can add Cookie: headers at will.


        • I still don't see how this solves the problem of the user agents loading already-set cookies into memory and sharing them with other browsers.

          A proxy is solving a different problem than the one I am talking about. :)
          • Ok, I don't think I've been very clear. Let me walk you through my crazy scheme.

            You write an HTTP proxy that captures cookies and modifies requests to include the cookies from its jar. When a browser makes a request through the proxy the proxy can decide to add cookies to the request based on its own cookie stash. It can ignore the cookies the browser has or doesn't have and substitute its own.

            Let's take as an example, me logging in to use.perl in Mozilla, then trying to access the site from IE.

            1. Moz
            • No, you were clear.

              That way the browser knows nothing about it. I want the browser to know about the cookies. I don't want an add on, I want browser support for it.
  • You should be able to do this with KeyChain, should you not?
    • You mean the MacOS X thing? I don't know anything about it, but the Help docs only mention passwords and HTML forms auto-fill-in. Additionally, I think the application has to be set up to use it.
  • You mean you haven't carefully studied all my columns already?

    I have a CGI-based remote cookie jar solution [], and you could trivially add a persistent cookie jar to my proxy server []. Both would work nicely, with differing results.

    • Randal L. Schwartz
    • Stonehenge
    • I still cannot manage stored cookies from the browser.

      I do not want a kludgey add-on---I want the browser to participate and to be able to see the cookies. With a proxy I have to develop a lot of external applications to handle all the things I can do in the browser now.

      What I want for Christmas is the magical world where all this is built into the user-agents I already use, and it works on every platform,a nd LWP supports it.

      And that is pure fantasy. :)
  • If you're looking for a proxy that can read and modify anything on both the requests and the response that flow trough it, you can have a look at HTTP::Proxy []. It's just a matter of writing the appropriate filters to handle the cookie headers in both the requests and responses.

    It's still in development, but I'm using it as my home proxy on a daily basis. So it basically works.

    Speaking of cookies, I'll soon publish a very simple script called mergecookies, that reads all your cookie files, merges all the co

  • I know you know how to do this, but...

    mergcookies [] is a little script that will merge all the cookies from all your cookie files. The only requirement is that the correct subclass of HTTP::Cookies is available for each browser. You can share cookies between browsers, though not as instantly as you would like.