Re: LWP cookies

From: Richard Bell (rbell01824_at_comcast.net)
Date: 03/29/04


Date: Sun, 28 Mar 2004 23:12:16 GMT

Alan J. Flavell wrote:
> On Sun, 28 Mar 2004, Richard Bell wrote:
>
>
>>As to the headers cookies et al. They are the result of what I would
>>get if I actually visited 18 pages of forms in turn to build the query I
>>post. Moreover, the server is VERY picky about what it will dance with.
>
>
> If it works with a browser, I'm not sure why it wouldn't work with
> LWP. The theory is that you just have to call it in the right way
> (unless the server is misbehaving - in which case you're on entirely
> the wrong group for discussing WWW server problems).

In the course of this dance, I neglected to mention that the 18 previous
pages use frames and very heavy scripting (some Java, some VB). While
I'm new to LWP and don't really know, I'm under the impression that
frames and LWP don't get on well, to say nothing of the scripts. That
aside, the code to visit all 18 pages would ultimately be IMHO rather
worse than the mess with the headers. But that is, of course, just my
preference.

>
>
>> In deference to reality I just send them all along.
>
>
> If they're in scope for the request, and they're in the cookie jar
> already, the module should know what to do with them. Duplicating
> that function does indeed look like re-inventing the wheel, and the
> code was anything -but- aesthetic - which is often a warning sign.[1]
>
The point is interesting. I could, as you seem to suggest, force the
values into the cookie jar and let LWP do a bit more work. It turns out
that the only real benefit here would be to allow LWP to set the content
length

$req18->header('Content-Length' => '384');

and of course, remove my concern about the session cookie (I'm still not
entirely sure which it is)

Still, I'm not sure IMHO that going to the trouble to dump the cookies
into the jar is worth the return (this is, after all, a perl hack).
Still it's a thought.

>
>>It is worth noting that many of the cookies hold the context
>>associated with what would happen if I in fact visited all 18 pages
>>(so they are in that sense necessary for the POST to work, hardly,
>>as you mentioned, wheel invention).
>
>
> But surely the point is that you want to present the POST request 'as
> if' you had visited those pages - and that's done by pre-loading the
> cookie jar with the appropriate cookies.
>
> good luck
>
> [1] even if, speaking as a physicist, I can "write FORTRAN in any
> language" ;-)

To each his own. My real concern, however, remains concerning a cookie
value forced in the header v. one in the cookie jar as it concerns the
session cookie. It's working, I'm OK with it, but I'd like to be a bit
more sure if anyone knows the underlying behavior of LWP in this case.

Thanks for your interest.

R



Relevant Pages

  • Re: LWP cookies
    ... RB> previous pages use frames and very heavy scripting (some Java, ... While I'm new to LWP and don't really know, ... RB> the values into the cookie jar and let LWP do a bit more work. ...
    (comp.lang.perl.misc)
  • LWP and java servlet error (newbie)
    ... When I go to that URL using Firefox or IE, ... I try it using LWP, I get a 'servlet exception error'. ... site via LWP by manually generating cookie file from Firefox and using ... generate a new cookie every day to make my scripts work, ...
    (comp.lang.perl.modules)
  • LWP - build a cookie by hand?
    ... I'm using LWP: ... How can I build my own cookie in to this code? ... server will always perceive me as "logged" in. ... I know this sounds like a CGI question, ...
    (comp.lang.perl.misc)
  • Re: Cannot modify cookies after HTTP headers have been sent
    ... the cookie is a header, so asp.net raises an error if you change it after the headers have been sent. ... Exception type: HttpException ... we've had errors from FF, IE6 and IE7, (and AOL users with each of ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: set cookie in nusoap web service, IE behaves diff than Firefox
    ... > browser as the first output. ... > Works fine in IE6 and the service returns the state of the cookie in the ... it rather implies that $this->headers refers to the headers sent ... I don't think 'Content-Type' is required in the request. ...
    (comp.lang.php)