http://qs1969.pair.com?node_id=48245


in reply to Re: How can I send a cookie as part of an HTTP request?
in thread How can I send a cookie as part of an HTTP request?

Actually, you can specify a cookie that gets sent to another domain. That's what the 'domain' parameter in CGI's cookie method is for. (If it's not specified, the default domain is the originating domain.)

Note, however, that browsers often have three settings for cookies; all cookies accepted, all cookies rejected, and cookies accepted except for cookies that aren't returned to the originating domain.

All that is irrelevant to the current question, of course; using LWP's get() method, you can send whatever cookies you want with the request.

  • Comment on Re: Answer: How can I send a cookie as part of an HTTP request?

Replies are listed 'Best First'.
Re: Re: Answer: How can I send a cookie as part of an HTTP request?
by extremely (Priest) on Dec 25, 2000 at 13:02 UTC
    Uhh, no that is exactly wrong. Clients are expected to ignore cookies that don't come from matching domains. If you request a resource from xxx.yyyy.com then the server that responds can set cookies for *.yyyy.com or xxx.yyyy.com but nothing else. What you are mixing in is the protection against you going to "http://www.xxx.com/" and that page calling a resource from "http://www.eviladplace.com/ad/tracker" and you picking up a cookie from a site you didn't even know you visited.

    All the domain parameter is for is setting the depth into your own domain. That way a server at www.cs.xxx.edu can set one cookie for all *.xxx.edu and another at just *.cs.xxx.edu and one just for itself at www.cs.xxx.edu! If I could set cookies in the netscape.com domain for you from hostile.org you can be sure I would be... =)

    LWP is most certainly the right answer tho! Look at HTTP::Request's perldocs specifically

    --
    $you = new YOU;
    honk() if $you->love(perl)