1
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-07 22:29:19 +00:00

01_FHEMWEB.pm: fix ETag/304 handling for iOS9 (Forum #41125)

git-svn-id: https://svn.fhem.de/fhem/trunk@9306 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2015-09-25 18:35:39 +00:00
parent 68eec7b7b6
commit b187d29e3e

View File

@ -307,11 +307,6 @@ FW_Read($$)
CommandDelete(undef, $name); CommandDelete(undef, $name);
Log3 $FW_wname, 4, "Connection closed for $name: ". Log3 $FW_wname, 4, "Connection closed for $name: ".
(defined($ret) ? 'EOF' : $!); (defined($ret) ? 'EOF' : $!);
if($hash->{BUF}) {
Log3 $FW_wname, 5, "BUF:>".$hash->{BUF}."< L:".length($hash->{BUF});
} else {
Log3 $FW_wname, 5, "BUF: EMPTY";
}
return; return;
} }
$hash->{BUF} .= $buf; $hash->{BUF} .= $buf;
@ -460,7 +455,7 @@ FW_Read($$)
my $length = length($FW_RET); my $length = length($FW_RET);
my $expires = ($cacheable? my $expires = ($cacheable?
("Expires: ".localtime($now+900)." GMT\r\n") : ""); ("Expires: ".FmtDateTimeRFC1123($now+900)."\r\n") : "");
Log3 $FW_wname, 4, Log3 $FW_wname, 4,
"$$:$name: $arg / RL:$length / $FW_RETTYPE / $compressed / $expires"; "$$:$name: $arg / RL:$length / $FW_RETTYPE / $compressed / $expires";
if( ! addToWritebuffer($hash, if( ! addToWritebuffer($hash,
@ -469,12 +464,12 @@ FW_Read($$)
$expires . $compressed . $FW_headercors . $expires . $compressed . $FW_headercors .
"Content-Type: $FW_RETTYPE\r\n\r\n" . "Content-Type: $FW_RETTYPE\r\n\r\n" .
$FW_RET, "FW_closeConn") ){ $FW_RET, "FW_closeConn") ){
Log3 $name, 4, "Closing connection $name due to full buffer in FW_Read"; Log3 $name, 4, "Closing connection $name due to full buffer in FW_Read"
if(!$hash->{isChild});
TcpServer_Close( $hash ); TcpServer_Close( $hash );
FW_closeConn($hash);
delete($defs{$name}); delete($defs{$name});
} }
FW_closeConn($hash);
} }
sub sub
@ -1578,9 +1573,12 @@ FW_returnFileAsStream($$$$$)
$if_none_match =~ s/"(.*)"/$1/ if($if_none_match); $if_none_match =~ s/"(.*)"/$1/ if($if_none_match);
$etag = (stat($path))[9]; #mtime $etag = (stat($path))[9]; #mtime
if(defined($etag) && defined($if_none_match) && $etag eq $if_none_match) { if(defined($etag) && defined($if_none_match) && $etag eq $if_none_match) {
my $now = time();
my $rsp = "Date: ".FmtDateTimeRFC1123($now)."\r\n".
"ETag: $etag\r\n".
"Expires: ".FmtDateTimeRFC1123($now+900)."\r\n";
TcpServer_WriteBlocking($FW_chash,"HTTP/1.1 304 Not Modified\r\n". TcpServer_WriteBlocking($FW_chash,"HTTP/1.1 304 Not Modified\r\n".
$FW_headercors . "\r\n"); $rsp . $FW_headercors . "\r\n");
FW_closeConn($FW_chash);
return -1; return -1;
} }
} }