develooper Front page | perl.libwww | Postings from January 2019

Set a wrong Content-Length with LWP

Octavian Rasnita
January 30, 2019 14:12
Set a wrong Content-Length with LWP
Message ID:
Hi all,

Does anyone know if it is possible to set a wrong Content-Length with LWP?
Or if not, then how can we do it?

The following corrects it and sets it to "Content-length: 5":
$ua->post( $url, 'Content-Length' => 3, Content => '12345' );

The following also does the same, plus it shows a warning telling that Content-Length was corrected:
my $req = HTTP::Request->new( POST => $url );
$req->header( 'Content-Length' => 3 );

I need to send a Content-Length that has a different value than the length of the posted content.

Thank you.

--Octavian Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About