Front page | perl.vmsperl |
Postings from January 2002
RE: LWP/HTTP Content-Length Calculation Error
Thread Previous
|
Thread Next
From:
Bohan, Larry
Date:
January 14, 2002 21:31
Subject:
RE: LWP/HTTP Content-Length Calculation Error
Message ID:
C055AF5D5DD1D2119C2700805F1582F00B3F0E53@EXCHANGE-SRVR-1
poor man's guess: older version of libwww ?
(I vaguely recall bumping into the content-length issue noted below)
http://search.cpan.org/doc/GAAS/libwww-perl-5.63/Changes
2001-01-12 Gisle Aas <gisle@ActiveState.com>
Release 5.50
Fix for test cases that failed because of URI-1.10 now encode
space as '+' instead of '%20. Patch by Christian Gilmore
<cgilmore@tivoli.com>.
Makefile.PL: Require URI-1.10.
HTTP::Daemon now accepts any non-space character as method name
on the request line. It used to fail on methods like "M-POST"
because it only allowed \w-chars.
HTTP::Date now allow fractional seconds in ISO date formats.
Based on patch from Mark D. Anderson <mda@discerning.com>
HTTP::Request::Common will now calculate Content-length
even if $DYNAMIC_FILE_UPLOAD is set. Patch provided by
Lindley, Lee T <Lee.Lindley@viasystems.com>.
-----Original Message-----
From: Kokosa, Chris [mailto:chris.kokosa@eds.com]
Sent: Monday, January 14, 2002 8:25 PM
To: 'winston@SLAC.Stanford.EDU'
Cc: 'vmsperl@perl.org'
Subject: RE: LWP/HTTP Content-Length Calculation Error
Sorry for confusion. The webserver is running on a Win32/IIS machine (a
second server is running UNIX/Netscape). The script below runs on VMS. To
make things more difficult the web server is managed by a third party and
they aren't too helpful.
The proxy setting is necessary for now. Eventually they're going to punch a
hole in the firewall between the Alpha and the web server. Until then I'm
stuck with the proxy server. The other GETS, PUTS and POSTS appear to work
fine other than this file upload.
-----Original Message-----
From: Alan Winston - SSRL Central Computing
[mailto:winston@SLAC.Stanford.EDU]
Sent: Monday, January 14, 2002 10:02 PM
To: Kokosa, Chris
Cc: 'vmsperl@perl.org'
Subject: Re: LWP/HTTP Content-Length Calculation Error
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