Phoenix.pm: LWP POST problems

Scott Walters scott at illogics.org
Thu May 6 18:30:40 CDT 2004


This is one of the few areas where I've rolled my own code since other
solutions are way overkill and have pathologically abstract interfaces.
So I can only watch the disucssion and cringe ;)

-scott

On  0, Matt Alexander <m at phxlinux.org> wrote:
> 
> On Thu, 6 May 2004, Eden Li wrote:
> 
> > According to LWP::UserAgent (and HTTP::Request::Common) docs, it appears 
> > that the quoted field does in fact get quoted correctly.  Have you tried 
> > using a web browser to input these values yourself?  It's possible curl 
> > is doing something strange with that % sign that you may not know about.
> > 
> > Here's an excerpt from HTTP::Request::Common docs (which is used by 
> > LWP::UserAgent)
> > 
> >    POST 'http://www.perl.org/survey.cgi',
> >         [ name   => 'Gisle Aas',
> >           email  => 'gisle at aas.no',
> >           gender => 'M',
> >           born   => '1964',
> >           perc   => '3%',
> >         ];
> > 
> > This will create a HTTP::Request object that looks like this:
> > 
> >    POST http://www.perl.org/survey.cgi
> >    Content-Length: 66
> >    Content-Type: application/x-www-form-urlencoded
> > 
> >    name=Gisle%20Aas&email=gisle%40aas.no&gender=M&born=1964&perc=3%25
> 
> 
> Mozilla has no problem when I input special characters and when I use the
> Live HTTP Headers Mozilla plugin to watch the HTTP session, I see that
> Mozilla has encoded the character correctly in the headers.
> 
> I can't think of anything that curl would be doing that's strange since
> the POST works as it should and the server responds correctly.
> 
> Is there a way to output the LWP headers as they are sent to the server?
> Then I could at least verify that LWP is creating the POST correctly
> before the server receives it.
> Thanks,
> ~M
> 



More information about the Phoenix-pm mailing list