From e800cfc74205d2db1dc1efb3b3049b4eb47a42ab Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Sun, 27 Sep 2015 12:44:35 +0000 Subject: [PATCH] 01_FHEMWEB.pm: workaround for iOS9 WebApp startup problem (Forum #41125) git-svn-id: https://svn.fhem.de/fhem/trunk@9321 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/01_FHEMWEB.pm | 28 +++++++++++++++++++++++++--- fhem/fhem.cfg.demo | 3 +-- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index bb5353310..5fff016da 100755 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/FHEM/01_FHEMWEB.pm @@ -140,6 +140,7 @@ FHEMWEB_Initialize($) allowfrom basicAuth basicAuthMsg + closeConn:1,0 column defaultRoom editConfig:1,0 @@ -318,7 +319,6 @@ FW_Read($$) } } - if(!$hash->{HDR}) { return if($hash->{BUF} !~ m/^(.*?)(\n\n|\r\n\r\n)(.*)$/s); $hash->{HDR} = $1; @@ -402,7 +402,7 @@ FW_Read($$) $hash->{LASTACCESS} = $now; $arg = "" if(!defined($arg)); - Log3 $FW_wname, 4, "HTTP $name GET $arg"; + Log3 $FW_wname, 4, "$name $method $arg; BUFLEN:".length($hash->{BUF}); $FW_ME = "/" . AttrVal($FW_wname, "webname", "fhem"); my $pf = AttrVal($FW_wname, "plotfork", undef); if($pf) { # 0 disables @@ -457,7 +457,7 @@ FW_Read($$) my $expires = ($cacheable? ("Expires: ".FmtDateTimeRFC1123($now+900)."\r\n") : ""); Log3 $FW_wname, 4, - "$$:$name: $arg / RL:$length / $FW_RETTYPE / $compressed / $expires"; + "name: $arg / RL:$length / $FW_RETTYPE / $compressed / $expires"; if( ! addToWritebuffer($hash, "HTTP/1.1 200 OK\r\n" . "Content-Length: $length\r\n" . @@ -476,6 +476,14 @@ sub FW_closeConn($) { my ($hash) = @_; + if(!$hash->{inform} && !$hash->{BUF}) { # Forum #41125 + my $cc = AttrVal($hash->{SNAME}, "closeConn", + $FW_userAgent=~m/(iPhone|iPad|iPod)/); + if(!$FW_httpheader{Connection} || $cc) { + TcpServer_Close($hash); + delete($defs{$hash->{NAME}}); + } + } POSIX::exit(0) if($hash->{isChild}); FW_Read($hash, 1) if($hash->{BUF}); } @@ -1578,6 +1586,7 @@ FW_returnFileAsStream($$$$$) my $rsp = "Date: ".FmtDateTimeRFC1123($now)."\r\n". "ETag: $etag\r\n". "Expires: ".FmtDateTimeRFC1123($now+900)."\r\n"; + Log3 $FW_wname, 4, "$FW_chash->{NAME} => 304 Not Modified"; TcpServer_WriteBlocking($FW_chash,"HTTP/1.1 304 Not Modified\r\n". $rsp . $FW_headercors . "\r\n"); return -1; @@ -3381,6 +3390,13 @@ FW_widgetOverride($$) attribute. + +