develooper Front page | perl.libwww | Postings from December 2000

Re: problem with Cookies and domain redirects

Thread Previous
From:
Steven Rasmussen
Date:
December 26, 2000 07:43
Subject:
Re: problem with Cookies and domain redirects
Message ID:
3A48BB84.28D03086@4secureorders.com
That is hard to accomplish.  The best write-up I've seen on
this subject is at:
http://www.pc-help.org/privacy/ms_guid.htm
which shows how MS accomplished what you need.

Good luck,

Steve
-- 
Steve Rasmussen          <Steve@4SecureOrders.com>
President
Secure Solutions Inc.    http://4SecureOrders.com

"Bad management can produce failure, but only 
good technology can yield success."

-- Bertrand Meyer, inventor of the Eiffel language


Bridget_Almas@ovid.com wrote:
> 
> I'm using the LWP modules in order to redirect users to a new url while
> hiding the parameters from their original form submission, and am having
> trouble getting the cookies set by the response to be set in the proper
> domain.
> 
>    So, for example, the user submits a form, which posts to
> 
>    http://domain1.com/mycgi.cgi
> 
>    I take that, read in the input parameters, and transform it to a new url
>    (at a new domain):
> 
>    my $newUrl=http://domain2.com/mycgi.cgi?param1=x&param2y
>    my $ua = LWP::UserAgent->new;
>    my $cookie_jar = new HTTP::Cookies;
>    $ua->cookie_jar($cookie_jar);
>    my $request = HTTP::Request->new('GET' => $newURL);
>    my $response = &request($ua, $request);
>    my $html = $response->content;
>    print $response->headers_as_string;
>    print "Content-type: text/html\n\n";
>    print $html;
> 
> The response includes several Set-Cookie headers, which are being accepted
> by the browser, but they're being set in the domain of the original url
> (i.e. domain1.com) instead of the newUrl (i.e. domain2.com), and thus are
> ignored by subsequent posts to the cgi running at domain2.com.
> 
> Does anyone know of a way to get the cookies set in the domain of the 2nd
> url?
> 
> Thanks.
> Bridget Almas



Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About