Matt Christian <[EMAIL PROTECTED]> writes: > > This patch kills the Content-Length both for the request itself and > > for the multipart/* parts. I think only the later is what you really > > want. > > > > I think the better fix is to simply remove the content-length for the > > parts. There is probably nothing that really requires them, even > > though they ought to be harmless. > > Yes, that was on purpose. The broken web server I need to interact with > doesn't understand Content-Length for the request or multipart/* parts. > If I send *any* Content-Length headers, it dies with a 5xx error.
But the Content-Length header for the request itself will be added by the protocol handler if the request does not have any. It means that not adding the Content-Length to the request itself should make no difference for the server. > > I don't want really want to introduce yet another ugly global. > > I don't like the ugly global either so I'm open to suggestions on how to > better handle it. Maybe add another option to > LWP::UserAgent->new(%options) ? Would that be preferred? No. POST() can be called without using LWP::UserAgent at all. > What are the chances of a (possibly modified) version of my patch making > it into libwww-perl proper? I'm open to suggestions... I'm willing to apply the following patch if you can confirm that it fixes your problem. Index: lib/HTTP/Request/Common.pm =================================================================== RCS file: /cvsroot/libwww-perl/lwp5/lib/HTTP/Request/Common.pm,v retrieving revision 1.22 diff -u -p -r1.22 Common.pm --- lib/HTTP/Request/Common.pm 23 Oct 2003 19:11:32 -0000 1.22 +++ lib/HTTP/Request/Common.pm 3 Jun 2004 13:31:05 -0000 @@ -152,7 +152,6 @@ sub form_data # RFC1867 local($/) = undef; # slurp files $content = <$fh>; close($fh); - $h->header("Content-Length" => length($content)); } unless ($ct) { require LWP::MediaTypes; Regards, Gisle