What am I doing wrong?  How can I get around this?  When I hit a redirection
on a GET it seems to work.  I'm _very_ new to LWP and this front end is
weird.  And I didn't write the redirectiomn stuff on the back side...

# host=10.0.0.4
# port=80
# doc=/cgi-bin/WebX?[EMAIL PROTECTED]^[email protected]
# formdata=subscribeMsgs=false&subscribeMsgs=true&subscribeEmail=false&
   subscribeDigest=false&+OK+.x=39&+OK+.y=12
# content_type=application/x-www-form-urlencoded
# content_length=121


    my ($host, $port, $doc, $formdata, $content_type, $content_length)=@_;

    my $ua=new LWP::UserAgent;
    my $req = new HTTP::Request 'POST', "http://$host$doc";;

    $req->content_type($content_type);
    $req->content_length($content_length) if $content_length;

    $req->content( $formdata );

    my $res = $ua->request($req);
    my $resp=$res->as_string;
    my $hdrs=$res->headers->as_string();
    if ($res->is_success) {
        $resp=$res->content();
        $result=$res->status_line;
        @lines=split(/\n/m, $hdrs);
    } else {
        print $res->error_as_HTML;
        $result=$res->status_line;
    }


prints
    An Error Occurred
    302 Found

My documentation says that if this error is in response to a GET the client
should try on the new URI (and LWP seems to do that for me when I am issuing
a GET, as I have hit GET redirects several times now on this project).  But
what do I do about redirecting a POST?

Is there an "excepted convention"?  Do I simply read through the headers
looking for the Location and repost?

Anyone willing to share some code that handles this cleanly?
-- 
- Vicki

Vicki Brown     ZZZ                  Journeyman Sourceror:
P.O. Box 1269      zz  |\     _,,,---,,_        Scripts & Philtres
San Bruno, CA       zz /,`.-'`'    -.  ;-;;,_     Perl, Unix, MacOS
94066     USA         |,4-  ) )-,_. ,\ ( `'-'
mailto:[EMAIL PROTECTED]  '---''(_/--'  `-'\_)  http://www.cfcl.com/~vlb

Reply via email to