develooper Front page | perl.libwww | Postings from July 2001

Re: Secial characters in post requests

Thread Previous
From:
Gisle Aas
Date:
July 26, 2001 10:46
Subject:
Re: Secial characters in post requests
Message ID:
lr7kwvtwiy.fsf@caliper.ActiveState.com
"Neven" <neven@wizcom.bg> writes:

> I have problem to post some spacial charecter in same way as they was posted from IExplorer
> example 
> 
> $resp=$ua->request(POST 'http://neven/',
>    [mail=>'neven@wizcom.bg']);
> 
> will produce following request
> 
> POST http://neven/ HTTP/1.0
> Host: neven
> User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)
> Content-Type: application/x-www-form-urlencoded
> 
> mail=neven%40wizcom.bg
> 
> but a want to post '@'  instead of %40 . If it is possible?

(Again) The two options I see:

   1) Postprocess the request before you pass it on:

         $req = POST ...;
         ${$req->content_ref} =~ s/%40/@/g;

   2) Update $URI::uric to not include @ before you create the
      request:

         use URI;
         $URI::uric =~ s/@//;  # don't want @ to be reserved

      I will not guarantee that this does not have any other
      bad side effect :-)

> other problem
> when try to post 
> 
> name='Jon Smit';
> 
> you will post
> Jon%20Smit but some browsers will post Jon+Smit
> So I want to post + instead of %20
> How can I control these diferences? 

This behaviour was changed in URI-1.10.  If you upgrade the URI module
beyond that point you should get what you want.

Regards,
Gisle

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About