2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 23:06:37 +00:00

HttpUtils.pm: Fix ContentLength (Forum #100977)

git-svn-id: https://svn.fhem.de/fhem/trunk@19493 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2019-05-30 08:47:46 +00:00
parent 568bef434a
commit 22d5213117

View File

@ -547,7 +547,7 @@ HttpUtils_Connect2($)
}
my $method = $hash->{method};
$method = ($data ? "POST" : "GET") if( !$method );
$method = (defined($data) && length($data) > 0 ? "POST" : "GET") if(!$method);
my $httpVersion = $hash->{httpversion} ? $hash->{httpversion} : "1.0";
@ -569,7 +569,7 @@ HttpUtils_Connect2($)
!($hash->{header} &&
$hash->{header} =~ /^Authorization:\s*Digest/mi));
$hdr .= $hash->{header}."\r\n" if($hash->{header});
if(defined($data)) {
if(defined($data) && length($data) > 0) {
$hdr .= "Content-Length: ".length($data)."\r\n";
$hdr .= "Content-Type: application/x-www-form-urlencoded\r\n"
if ($hdr !~ "Content-Type:");