I'm curious if anyone's familiar with how LWP gets cookies into the
final request that's sent.

AIUI, you create a request using an HTTP::Headers object. Then the
request object is sent to the user-agent object. Now, the user-agent
object has a cookie jar associated with it (not the request object), so
presumably it adds those cookies in prior to the actual request(?)

How can I prove to myself it's really sending the cookies?

Paul

<code>
# Am I doing this right? (the gist; this is edited)

    my $jar = HTTP::Cookies->new;
    my $ua = LWP::UserAgent->new;
    $ua->cookie_jar($jar);
    foreach my $get (@$chat) {
        my $req = $get->{request};
        my $headers = HTTP::Headers->new();
        my $content = $req->{content} || "";
        my $request = HTTP::Request->new($req->{method}, $req->{url}, $headers, 
$content);
        warn "Cookie: ", $headers->header("cookie"), "\n" if 
$headers->header("cookie");
                        #... no cookie seen here of course.
        my $response = $ua->request($request, "$output_dir/$file");
</code>

Reply via email to