HttpUtils.pm: allow header as HASH (Forum #43451)

git-svn-id: https://svn.fhem.de/fhem/trunk@9768 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig
2015-11-04 06:10:26 +00:00
parent f1c496d1d0
commit 4182203f4d

View File

@@ -240,6 +240,13 @@ HttpUtils_Connect2($)
}
}
if(defined($hash->{header})) {
if( ref($hash->{header}) eq 'HASH' ) {
$hash->{header} = join("\r\n",
map(($_.': '.$hash->{header}{$_}), keys($hash->{header})));
}
}
$hash->{host} =~ s/:.*//;
my $method = $hash->{method};
$method = ($data ? "POST" : "GET") if( !$method );
@@ -514,7 +521,7 @@ HttpUtils_ParseAnswer($$)
# mandatory:
# url, callback
# optional(default):
# hideurl(0),timeout(4),data(""),loglevel(4),header(""),
# hideurl(0),timeout(4),data(""),loglevel(4),header("" or HASH),
# noshutdown(1),shutdown(0),httpversion("1.0"),ignoreredirects(0)
# method($data ? "POST" : "GET"),keepalive(0),sslargs({})
# Example: