Help regarding HTTP::Request:POST

Help regarding HTTP::Request:POST

am 25.02.2006 05:31:02 von Jamuna

Hi All:

I'm facing an issue with the HTTP::Request:POST function.
My Code is trying to post some content to other applications and should
get an appropriate response. Some of the calling applications reside on
the same server as my application and a few reside on some other
servers too.

The POST call fails when my application tries to send content to
applications on other servers and if the content contains some special
characters like ";" "\n" etc.
It truncates the content once it encounters the above mentioned
characters and only partially the content is sent to the application.
Hence i dont get the desired output from the application.

Below is a snippet of the code that performs the POST logic:

my $headers = HTTP::Headers->new() ;
my $request= HTTP::Request->new("POST", $URL, $headers);
$request->content($contenttext);
$request->content_type('application/x-www-form-urlencoded');

$contenttext - contains my content
$url - contains my calling application URL

Kindly let me know what can be the issue and a solution.

Thank You,
Jamuna

Re: Help regarding HTTP::Request:POST

am 25.02.2006 10:44:45 von Michael Greb

In article <1140841862.060971.196110@u72g2000cwu.googlegroups.com>,
"Jamuna" wrote:

> Hi All:
>
> I'm facing an issue with the HTTP::Request:POST function.
> My Code is trying to post some content to other applications and should
> get an appropriate response. Some of the calling applications reside on
> the same server as my application and a few reside on some other
> servers too.
>
> The POST call fails when my application tries to send content to
> applications on other servers and if the content contains some special
> characters like ";" "\n" etc.
> It truncates the content once it encounters the above mentioned
> characters and only partially the content is sent to the application.
> Hence i dont get the desired output from the application.
>
> Below is a snippet of the code that performs the POST logic:
>
> my $headers = HTTP::Headers->new() ;
> my $request= HTTP::Request->new("POST", $URL, $headers);
> $request->content($contenttext);
> $request->content_type('application/x-www-form-urlencoded');
>
> $contenttext - contains my content
> $url - contains my calling application URL
>
> Kindly let me know what can be the issue and a solution.
>
> Thank You,
> Jamuna

Are you encoding $contenttext before posting it?

This line
> $request->content_type('application/x-www-form-urlencoded');
claims that the text os url-encoded so you will need to url-encode
$contenttext before posting it.

Michael

Re: Help regarding HTTP::Request:POST

am 27.02.2006 06:52:34 von Jamuna

Yes Michael. Since the characters ";","\n" and "&" are hampering the
post calls, we have encoded them currently.

Jamuna