GrahamBright
Programmer
Hi all,
I have an interesting but frustrating problem.
I use a combination of LWP::UserAgent, HTTP:Header and HTTP::Request to submit a simple HTTP POST message to a Web Server containing a Base64 encoded picture.
I can submit the request to the Web Server with out difficultiy.
However, if I try to send a large Base64 encoded image (over 4k) in the request, the Base64 encoded data is corrupt.
I am not sure what is causing the corruption ? TCP segment length or line feeds.
Q. How can I remodel my application to submit BASE64 picture without line feeds.
Q. Why are the line feeds introduced, I think these are returned by Apache
With kind regards,
Graham.
Application code .
#!/opt/perl5/bin/perl
# $Revision: 1.1.1.3 $
#
# $Date: 2003/06/25 17:40:00 $
use LWP::UserAgent(keep_alive => 100,timeout =>60);
use HTTP::Request;
use HTTP::Headers;
use LWP:
ebug qw(+);
my $objUserAgent = LWP::UserAgent->new;
#####additions
#$objUserAgent->max_size(2034);
$SOAP_FILE="/home/mkuetk/perlScripts/VASATPS/old/Soap_Request";
open(REQUEST, "<$SOAP_FILE") || die "Unable to open Soap Request file $!";
while ($Bytes = read(\*REQUEST, $Buffer, 500))
{
$soap_infile .= $Buffer;
chomp($soap_infile);
}
my $objHeader = HTTP::Headers->new;
$objHeader->authorization_basic("436641231239","msntest");
$objHeader->push_header('SoapAction' => '""');
$objHeader->push_header('Content-Length' => length($soap_infile));
$objHeader->push_header('Content-Type' => 'multipart/related; boundary="soap-border"; type="text/xml"; start ="<Test>"');
#Test System
my $objRequest = HTTP::Request->new("POST", ' $soap_infile);
my $objResponse = $objUserAgent->request($objRequest);
#Process Response#######
if ($objResponse->is_success)
{
print $objResponse->content;
}
close(REQUEST);
##############
I have an interesting but frustrating problem.
I use a combination of LWP::UserAgent, HTTP:Header and HTTP::Request to submit a simple HTTP POST message to a Web Server containing a Base64 encoded picture.
I can submit the request to the Web Server with out difficultiy.
However, if I try to send a large Base64 encoded image (over 4k) in the request, the Base64 encoded data is corrupt.
I am not sure what is causing the corruption ? TCP segment length or line feeds.
Q. How can I remodel my application to submit BASE64 picture without line feeds.
Q. Why are the line feeds introduced, I think these are returned by Apache
With kind regards,
Graham.
Application code .
#!/opt/perl5/bin/perl
# $Revision: 1.1.1.3 $
#
# $Date: 2003/06/25 17:40:00 $
use LWP::UserAgent(keep_alive => 100,timeout =>60);
use HTTP::Request;
use HTTP::Headers;
use LWP:
my $objUserAgent = LWP::UserAgent->new;
#####additions
#$objUserAgent->max_size(2034);
$SOAP_FILE="/home/mkuetk/perlScripts/VASATPS/old/Soap_Request";
open(REQUEST, "<$SOAP_FILE") || die "Unable to open Soap Request file $!";
while ($Bytes = read(\*REQUEST, $Buffer, 500))
{
$soap_infile .= $Buffer;
chomp($soap_infile);
}
my $objHeader = HTTP::Headers->new;
$objHeader->authorization_basic("436641231239","msntest");
$objHeader->push_header('SoapAction' => '""');
$objHeader->push_header('Content-Length' => length($soap_infile));
$objHeader->push_header('Content-Type' => 'multipart/related; boundary="soap-border"; type="text/xml"; start ="<Test>"');
#Test System
my $objRequest = HTTP::Request->new("POST", ' $soap_infile);
my $objResponse = $objUserAgent->request($objRequest);
#Process Response#######
if ($objResponse->is_success)
{
print $objResponse->content;
}
close(REQUEST);
##############