2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

HttpUtils: method parameter from justme1968

git-svn-id: https://svn.fhem.de/fhem/trunk@5200 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2014-03-11 13:33:21 +00:00
parent 30f2ade339
commit 61bab752f7

View File

@ -184,7 +184,10 @@ HttpUtils_Connect2($)
} }
$hash->{host} =~ s/:.*//; $hash->{host} =~ s/:.*//;
my $hdr = ($data ? "POST" : "GET")." $hash->{path} HTTP/1.0\r\n"; my $method = $hash->{method};
$method = ($data ? "POST" : "GET") if( !$method );
my $hdr = "$method $hash->{path} HTTP/1.0\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}));
@ -295,7 +298,8 @@ HttpUtils_ParseAnswer($$)
# mandatory: # mandatory:
# url, callback # url, callback
# optional(default): # optional(default):
# hideurl(0),timeout(4),data(""),noshutdown(0),loglevel(4),header("") # hideurl(0),timeout(4),data(""),noshutdown(0),loglevel(4),header(""),
# method($data ? "POST" : "GET")
# Example: # Example:
# HttpUtils_NonblockingGet({ # HttpUtils_NonblockingGet({
# url=>"http://192.168.178.112:8888/fhem", # url=>"http://192.168.178.112:8888/fhem",