diff --git a/fhem/FHEM/98_HTTPMOD.pm b/fhem/FHEM/98_HTTPMOD.pm index 728b00650..141c6640f 100755 --- a/fhem/FHEM/98_HTTPMOD.pm +++ b/fhem/FHEM/98_HTTPMOD.pm @@ -146,6 +146,8 @@ # 2017-09-06 new attribute reAuthAlways to do the defined authentication steps # before each get / set / getupdate regardless of any reAuthRegex setting or similar. # 2018-01-18 added preProcessRegex e.g. to fix broken JSON data in a response +# 2018-02-10 modify handling of attribute removeBuf since httpUtils doesn't expose its buffer anymore, +# Instead new attribute showBody to explicitely show a formatted version of the http response body (header is already shown) # # @@ -211,7 +213,7 @@ sub HTTPMOD_AddToQueue($$$$$;$$$$); sub HTTPMOD_JsonFlatter($$;$); sub HTTPMOD_ExtractReading($$$$$); -my $HTTPMOD_Version = '3.4.1 - 18.1.2018'; +my $HTTPMOD_Version = '3.4.2 - 10.2.2018'; # # FHEM module intitialisation @@ -274,7 +276,8 @@ sub HTTPMOD_Initialize($) "showMatched:0,1 " . "showError:0,1 " . - "removeBuf:0,1 " . + "showBody " . # expose the http response body as internal + #"removeBuf:0,1 " . # httpUtils doesn't expose buf anymore "preProcessRegex " . "parseFunction1 " . @@ -2178,7 +2181,7 @@ sub HTTPMOD_GetCookies($$) sub HTTPMOD_InitParsers($$) { my ($hash, $body) = @_; - my $name = $hash->{NAME}; + my $name = $hash->{NAME}; # initialize parsers if ($hash->{JSONEnabled} && $body) { @@ -2441,7 +2444,10 @@ sub HTTPMOD_Read($$$) $buffer = ($header ? $header . "\r\n\r\n" . $body : $body); # for matching sid / reauth $buffer = $buffer . "\r\n\r\n" . $err if ($err); # for matching reauth - delete $hash->{buf} if (AttrVal($name, "removeBuf", 0)); + #delete $hash->{buf} if (AttrVal($name, "removeBuf", 0)); + if (AttrVal($name, "showBody", 0)) { + $hash->{httpbody} = $body; + } HTTPMOD_InitParsers($hash, $body); HTTPMOD_GetCookies($hash, $header) if (AttrVal($name, "enableCookies", 0)); @@ -3545,8 +3551,10 @@ HTTPMOD_AddToQueue($$$$$;$$$$){ if set to 1 then HTTPMOD will create a reading and event with the Name LAST_ERROR that contains the error message of the last error returned from HttpUtils.