mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +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:
parent
85d8d19a91
commit
c3e6b71809
@ -188,7 +188,7 @@ HttpUtils_Connect2($)
|
|||||||
my $method = $hash->{method};
|
my $method = $hash->{method};
|
||||||
$method = ($data ? "POST" : "GET") if( !$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 .= "Host: $hash->{host}\r\n";
|
||||||
$hdr .= "Authorization: Basic $hash->{auth}\r\n" if(defined($hash->{auth}));
|
$hdr .= "Authorization: Basic $hash->{auth}\r\n" if(defined($hash->{auth}));
|
||||||
$hdr .= $hash->{header}."\r\n" if(defined($hash->{header}));
|
$hdr .= $hash->{header}."\r\n" if(defined($hash->{header}));
|
||||||
@ -266,7 +266,7 @@ HttpUtils_ParseAnswer($$)
|
|||||||
return ("$hash->{displayurl}: empty answer received", "");
|
return ("$hash->{displayurl}: empty answer received", "");
|
||||||
}
|
}
|
||||||
Log3 undef,$hash->{loglevel}, "$hash->{displayurl}: HTTP response code $code";
|
Log3 undef,$hash->{loglevel}, "$hash->{displayurl}: HTTP response code $code";
|
||||||
|
$hash->{code} = $code;
|
||||||
if($code==301 || $code==302 || $code==303) { # redirect
|
if($code==301 || $code==302 || $code==303) { # redirect
|
||||||
if(++$hash->{redirects} > 5) {
|
if(++$hash->{redirects} > 5) {
|
||||||
return ("$hash->{displayurl}: Too many redirects", "");
|
return ("$hash->{displayurl}: Too many redirects", "");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user