in reply to Re: HTTP Post read response , Post again
in thread HTTP Post read response , Post again

I believe you mean to do two requests on the same connection? Yet you do nothing to tell LWP to do so (assuming it's even capable of doing so). Yes. HTTP 1.1 Post; read response. If successful; post again with new request. But on the same connection. If you know TCP you will see in TCP header Source Port, Destination Port, Sequence Number, next sequence number, ack number. For two consutive posts TCP sequence number always starts from 1. Webserver is: thttpd.
#!/usr/bin/perl -w use strict; use LWP::UserAgent; use HTTP::Request::Common; #Post 1 for login my $userAgent = LWP::UserAgent->new(agent => 'Perlprogram/0.1'); my $message = "UserID: Username, Password: passwordr"; my $response = $userAgent->request(POST 'http://someip:port/', Content_Type => 'application/text', Connection => 'Keep-alive', Content => $message); #print $response->error_as_HTML unless $response->is_success; #print $response->as_string; if ($response->is_success) { print $response->content; #post again if success my $userAgent2 = LWP::UserAgent->new(agent => 'Perlprogram/0.1'); my $message2 = "GetParam"; my $response2 = $userAgent2->request(POST 'http://someip:port/', Content_Type => 'application/text', Connection => 'Keep-alive', Content => $message2); print $response2->error_as_HTML unless $response2->is_success; print $response2->as_string; } else { print $response->status_line, "\n"; }
I see in some new response my Keep-alive syntext was not proper. Let me modify and will post you result. Thanks for replies guys.....