develooper Front page | perl.vmsperl | Postings from January 2002

Re: LWP/HTTP Content-Length Calculation Error

Thread Previous | Thread Next
From:
Alan Winston - SSRL Central Computing
Date:
January 14, 2002 20:08
Subject:
Re: LWP/HTTP Content-Length Calculation Error
Message ID:
01KD2NVQX3KW95742M@SSRL.SLAC.STANFORD.EDU
Chris wrote:

> I'm trying to run a script that does a file upload via POST on a VMS node.
> I've download and successfully compiled a version of VMS Perl from "Craig
> Berry's 5.6.1 easy-to-install release".  When I run the script on Win32 it
> runs fine.  When I run the app on VMS the web server replies with a "500
> length of data sent did not match calculated Content-Length header..."

> Is the content-length calculation wrong or is it a difference between OSs?
> I noticed that when I don't use the dynamic_file_upload that the
> content-length in the file field is at 4096 for a 3705K file.  4096 is a
> very familiar number ;-)  The $^O variable says that I'm running VMS.

I'm confused.  Is the webserver that you're trying to reach on VMS, or are
you on VMS running the script?  If the webserver is on VMS, the following
questions may be relevant:


What webserver are you using on VMS?  I've just been looking at the WASD
docs, and I see WASD has a default buffer-size of 4096 for communicating with
CGIs.  I don't think that would necessarily cut the file short, but it might.
(This is a settable parameter in WASD.)

Also, it looks like you've got a proxy server between you and the system you're
trying to get to.  What's the proxy server running?  Can you get around it
and use the end-node directly?

> I've tried everything.  If this is a bug I'll code the thing in C via
> sockets (yuck).

> Here's the script:
> ----------------------------------------------------------------------------
> -------------------------------
> use strict;

> use LWP::Debug qw(+);
> use LWP::UserAgent;
> use HTTP::Request::Common qw(POST);
> use MIME::Base64;

> $HTTP::Request::Common::DYNAMIC_FILE_UPLOAD++;

> my $ua = new LWP::UserAgent;
> $ua->agent("fris_1.0");

> my $proxy_server = "http://myproxy.com";
> my $proxy_userid = "uid";
> my $proxy_password = "pass";

> my $url = "http://uploadserver.com/servlet/UploadFile";
> my $filename = "test.txt";

> my $req = POST ($url,
>                Content_Type => 'form-data',
>                Content => [ The_UserID => 'form_uid',
>                             The_Password => 'form_pass',
>                             Dir => 'destdir/',
>                             File => [$filename,$filename]
>                           ]);

> $ua->proxy(http => $proxy_server);
> $req->proxy_authorization_basic( $proxy_userid, $proxy_password );

> my $res = $ua->request($req);

> print $res->status_line."\n";
> print $res->content;

> ----------------------------------------------------------------------------
> -------------------------------

> Chris Kokosa
> EDS Embedded Systems
> chris.kokosa@eds.com



===============================================================================
 Alan Winston --- WINSTON@SSRL.SLAC.STANFORD.EDU
 Disclaimer: I speak only for myself, not SLAC or SSRL   Phone:  650/926-3056
 Paper mail to: SSRL -- SLAC BIN 99, 2575 Sand Hill Rd, Menlo Park CA   94025
===============================================================================


Thread Previous | Thread Next


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