2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

HttpUtils: return code and change to HTTP/1.1 (Forum #24163)

git-svn-id: https://svn.fhem.de/fhem/trunk@6023 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2014-06-01 11:50:16 +00:00
parent 85d8d19a91
commit c3e6b71809

View File

@ -188,7 +188,7 @@ HttpUtils_Connect2($)
my $method = $hash->{method};
$method = ($data ? "POST" : "GET") if( !$method );
my $hdr = "$method $hash->{path} HTTP/1.0\r\n";
my $hdr = "$method $hash->{path} HTTP/1.1\r\n";
$hdr .= "Host: $hash->{host}\r\n";
$hdr .= "Authorization: Basic $hash->{auth}\r\n" if(defined($hash->{auth}));
$hdr .= $hash->{header}."\r\n" if(defined($hash->{header}));
@ -266,7 +266,7 @@ HttpUtils_ParseAnswer($$)
return ("$hash->{displayurl}: empty answer received", "");
}
Log3 undef,$hash->{loglevel}, "$hash->{displayurl}: HTTP response code $code";
$hash->{code} = $code;
if($code==301 || $code==302 || $code==303) { # redirect
if(++$hash->{redirects} > 5) {
return ("$hash->{displayurl}: Too many redirects", "");