I've now applied this patch. To appear in LWP-5.811.
diff --git a/lib/HTTP/Request/Common.pm b/lib/HTTP/Request/Common.pm
index d1ec52a..b0c8951 100644
--- a/lib/HTTP/Request/Common.pm
+++ b/lib/HTTP/Request/Common.pm
@@ -104,6 +104,7 @@ sub _simple_req
while (($k,$v) = splice(@_, 0, 2)) {
if (lc($k) eq 'content') {
$req->add_content($v);
+ $req->header("Content-Length", length(${$req->content_ref}));
}
else {
$req->push_header($k, $v);
diff --git a/t/base/common-req.t b/t/base/common-req.t
index 66f74b4..5c4ba0d 100644
--- a/t/base/common-req.t
+++ b/t/base/common-req.t
@@ -30,7 +30,7 @@ print "not " if defined($r->header("Content"));
print "ok 5\n";
print "not " unless ${$r->content_ref} eq "foo" and
- $r->content eq "foo";
+ $r->content eq "foo" and $r->content_length == 3;
print "ok 6\n";
#--- Test POST requests ---