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

Set a wrong Content-Length with LWP

From:
Octavian Rasnita
Date:
January 30, 2019 14:12
Subject:
Set a wrong Content-Length with LWP
Message ID:
037001d4b8a5$b914cdd0$6500a8c0@OctavianTOSH
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 );
$req->content("12345");

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

Thank you.

--Octavian



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