quency has asked for the wisdom of the Perl Monks concerning the following question:
I wrote a perl script to send a request to HTTP server using LWP::UserAgent. The code is here:
---------------------------------------------------------------------------------------------------------------$url = 'http://151.104.234.14/voipadmin/security_chk'; $ua = new LWP::UserAgent; $res = $ua->request(POST $url, Content => [ Submit => 'Submit', user => 'admin', passwd => 'password' ] );
When I use the microsoft network monitor to capture the packets, I found that the POST request is not sent correctly. It is sent twice. The 1st sending doesn't include the content (or data ) and the content is sent in the 2nd http request and is not sent as data. Here are the 2 frames I captured:
--------- 1st frame POST request ----------- HTTP: POST Request (from client using port 34746) HTTP: Request Method = POST HTTP: Uniform ResourceIdentifier=/voipadmin/security_chk HTTP: Protocol Version = HTTP/1.1 HTTP: Connection = Keep-Alive HTTP: Host = 151.104.234.14 HTTP: User-Agent = libwww-perl/5.65 HTTP: Content-Length = 35 HTTP: Content-Type = application/x-www-form-urlencoded --------- 2nd frame POST request ----------- HTTP: Submit=Submit&j_username=admin&j_password=password Request (from + client using p HTTP: Request Method = Submit=Submit&user=admin&passwd=password ----------------------------------------------------
Obviously I don't get right response becasue the request is not sent correctly. The request should be sent in one packet, but look like LWP::UserAgent seperates message and send it twice. This is not correct. I check the Max_Size and it is undef (means there is no limit for the packet size). Anyone see this problem before? Any idea about this?
Thanks for your help.
Quency
20040528 Edit by Corion: Added formatting
Edit by BazB: changed all password strings to "password"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTTP::Request(POST, ...)
by iburrell (Chaplain) on May 28, 2004 at 23:12 UTC | |
by Anonymous Monk on Jun 01, 2004 at 17:48 UTC | |
by Corion (Patriarch) on Jun 01, 2004 at 17:57 UTC | |
by Anonymous Monk on Jun 04, 2004 at 19:15 UTC | |
by Corion (Patriarch) on Jun 04, 2004 at 19:23 UTC |