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

problem with Cookies and domain redirects

Thread Next
December 22, 2000 08:13
problem with Cookies and domain redirects
Message ID:
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

   So, for example, the user submits a form, which posts to

   I take that, read in the input parameters, and transform it to a new url
   (at a new domain):

   my $newUrl=
   my $ua = LWP::UserAgent->new;
   my $cookie_jar = new HTTP::Cookies;
   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. instead of the newUrl (i.e., and thus are
ignored by subsequent posts to the cgi running at

Does anyone know of a way to get the cookies set in the domain of the 2nd

Bridget Almas

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About