Levent Ozturk
Enter
HTTP encoding url post

POST / HTTP/1.1
Host: foo.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 13

arg1=val1&arg2=val2

------------------------------------------------------------------------------------------------------

POST /test.html HTTP/1.1
Host: domain.com 
Content-Type: multipart/form-data;boundary="<boundary_text>"

--boundary_text
Content-Disposition: form-data; name="field1"

value1
--boundary_text
Content-Disposition: form-data; name="field2"; filename="<filename>"

value2

--boundary_text--

-----------------------------------------------------------------------------------------------------

GET and POST with  application/x-www-form-urlencoded type must be url encoded before sending.

base64 converts binary to printible string. Iti s not url encoding. URL encodeng encodes &;?... charters in the vriables. These charcters are used to parse the url and must not be contained in the values of the variables in the url.

application/x-www-form-urlencoded is automatially url decoded by CGI.pm. If the receiver needs to get the undecoded (encoded)  data,  multipart/form-data must be used.

 

 

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;

my $ua = new LWP::UserAgent();

my $res = $ua->request(POST $auth,

                       Content_Type => 'form-data',

                       Content =>                                  [arg1 => 'val',

                                                                         ,arg2 => 'val2']);

 

 

This code will constrcut and send  multipart/form-data so that it is not decoded in the receiver

 

All the material listed and linked at this World Wide Web domain are strictly private property and copyrighted. © Copyright -∞-∞ Levent Ozturk. All rights reserved. Reproduction or use of any material, documents and related graphics and any other material from this World Wide Web server is strictly prohibited. Site Map