From c80d41fa80457694e88d89dfb215dff488a06e49 Mon Sep 17 00:00:00 2001 From: StefanStrobel <> Date: Fri, 7 Feb 2020 19:36:06 +0000 Subject: [PATCH] 98_HTTPMOD: delete internal with http body if attribute showBody is set to 0 git-svn-id: https://svn.fhem.de/fhem/trunk@21141 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_HTTPMOD.pm | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/fhem/FHEM/98_HTTPMOD.pm b/fhem/FHEM/98_HTTPMOD.pm index c70f63ddd..12d5c421a 100755 --- a/fhem/FHEM/98_HTTPMOD.pm +++ b/fhem/FHEM/98_HTTPMOD.pm @@ -172,6 +172,7 @@ # 2019-11-20 precompilation of preProcessRegex removed - can't compile a regex inluding a replacement part for s// # 2019-11-29 new fix for special compiled regexes with regex options # 2019-12-27 delete hash-{method} if not explicitely set +# 2020-02-07 delete $hash->{httpbody} when showBody is set to 0 or deleted # # @@ -243,12 +244,12 @@ sub HTTPMOD_AddToQueue($$$$$;$$$$$); sub HTTPMOD_JsonFlatter($$;$); sub HTTPMOD_ExtractReading($$$$$); -my $HTTPMOD_Version = '3.5.21 - 27.12.2019'; +my $HTTPMOD_Version = '3.5.22 - 7.2.2020'; -# + +######################################################################### # FHEM module intitialisation # defines the functions to be called from FHEM -######################################################################### sub HTTPMOD_Initialize($) { my ($hash) = @_; @@ -733,10 +734,17 @@ sub HTTPMOD_Attr(@) return "Please install JSON Library to use JSON (apt-get install libjson-perl) - error was $@"; } $hash->{JSONEnabled} = 1; + } elsif ($aName eq "enableCookies") { if ($aVal eq "0") { delete $hash->{HTTPCookieHash}; } + + } elsif ($aName eq "showBody") { + if ($aVal eq "0") { + delete $hash->{httpbody}; + } + } elsif ($aName eq "enableXPath" || $aName =~ /(get|reading)[0-9]+XPath$/ || $aName =~ /[Rr]eAuthXPath$/ @@ -832,6 +840,9 @@ sub HTTPMOD_Attr(@) } elsif ($aName eq "enableCookies") { delete $hash->{HTTPCookieHash}; + } elsif ($aName eq "showBody") { + delete $hash->{httpbody}; + } elsif ($aName =~ /(reading|get)[0-9]*(-[0-9]+)?MaxAge$/) { if (!(grep !/$aName/, grep (/(reading|get)[0-9]*(-[0-9]+)?MaxAge$/, keys %{$attr{$name}}))) { delete $hash->{MaxAgeEnabled}; @@ -1721,6 +1732,7 @@ sub HTTPMOD_Caller() my ($package, $filename, $line, $subroutine, $hasargs, $wantarray, $evaltext, $is_require, $hints, $bitmask, $hinthash) = caller 2; return $1 if ($subroutine =~ /main::HTTPMOD_(.*)/); return $1 if ($subroutine =~ /main::(.*)/); + return 'Fhem internal timer' if ($subroutine =~ /main::HandleTimeout/); return "$subroutine"; } @@ -3655,12 +3667,12 @@ sub HTTPMOD_AddToQueue($$$$$;$$$$$){ Further replacements of URL, header or post data