Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: How can I stop a POST from url encoding.

by amphiplex (Monk)
on Jun 29, 2002 at 11:20 UTC ( #178228=note: print w/replies, xml ) Need Help??


in reply to How can I stop a POST from url encoding.

There are two issues here:
  • changing the http-version: The only way to do this that I have found is to set an Environment Variable
  • url-encoding: Just set the content with the content method provided by HTTP::Request

Here is a small example that should do what you wanted:
use strict; sub BEGIN { # force HTTP version to 1.0 $ENV{PERL_LWP_USE_HTTP_10} = "1"; } use LWP::UserAgent; use HTTP::Request::Common qw(POST); my $ua = new LWP::UserAgent (); my $req = POST 'http://localhost:4443/test.pl'; $req->content("<user>john\@doe</user>"); print $req->as_string; my $response = $ua->request($req); print $response->as_string;
Update:Please be careful when using the "trick" with the Environmant Vaiable, as I have seen it in the code not in any documentation. So I believe that this is an inofficial feature, which could disappear with a new version of LWP.
---- kurt

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://178228]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2022-09-27 14:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (119 votes). Check out past polls.

    Notices?