ETagヘッダー フィールドは、応答専用です。
ETag応答ヘッダー フィールドは、要求されたバリアントのエンティティ タグの現在の値を提供します。
ただし、メソッドはIf-None-Matchヘッダー フィールドgetEtags
のタグである可能性があります。
エンティティ タグのいずれかが、そのリソースの同様の GET 要求 ( If-None-Matchヘッダーなし)への応答で返されるエンティティのエンティティ タグと一致する場合、または " *
" が指定され、現在のエンティティがそのリソースに対して存在する場合、リソースの変更日がリクエストのIf-Modified-Sinceヘッダー フィールドで提供されたものと一致しないために必要な場合を除き、サーバーはリクエストされたメソッドを実行してはなりません (MUST NOT) 。代わりに、リクエスト メソッドが GET または HEAD の場合、サーバーは、キャッシュ関連のヘッダー フィールド (特にETag) 一致したエンティティの 1 つ。他のすべてのリクエスト メソッドの場合、サーバーは 412 (Precondition Failed) のステータスで応答する必要があります。
これは、指定されたコードと正確に一致しているようです (コードに合わせて最初の文を再配置しました)。
// the server MUST NOT perform the requested method
$notModified = (
// if any of the entity tags match the entity tag of the entity that
// would have been returned in the response to a similar GET request
// (without the If-None-Match header) on that resource
in_array($this->getEtag(), $etags)
// or if "*" is given and any current entity exists for that resource
|| in_array('*', $etags))
// unless required to do so because the resource's modification
// date fails to match that supplied in an If-Modified-Since header
// field in the request.
&& (!$lastModified || $this->headers->get('Last-Modified') == $lastModified);
最後の式は、最後の文の部分によりよく適合する(!$lastModified || $this->headers->get('Last-Modified') == $lastModified)
ものと同等です。!($lastModified && $this->headers->get('Last-Modified') != $lastModified)