<?php
$IfNoneMatchTestPattern = '#^((W/)?"[\x00-\x7f]*?", )*(W/)?"[\x00-\x7f]*?"$#' ;
$IfNoneMatchEtagsPattern = '#(?:W/)?("[\x00-\x7f]*?")(?=$|, (?:W/)?"[\x00-\x7f]*?")#' ;
if ( ! preg_match ( $IfNoneMatchTestPattern , $headerValue ) ) {
write2log( "Нестандартный Etag $headerValue ." , ADD_CLIENT_HEADERS) ;
$headerETags = array ( $headerValue ) ;
} elseif ( preg_match_all ( $IfNoneMatchEtagsPattern , $headerValue , $headerETags ) ) {
$headerETags = $headerETags [ 1 ] ; // первая подмаска
} else {
write2log( "If-None-Match прошел проверку, но не дал совпадений. Шта?" , ADD_CLIENT_HEADERS) ;
$headerETags = array ( $headerValue ) ;
}
PD9waHAKCiRoZWFkZXJFVGFncyA9IGFycmF5KCk7CgokSWZOb25lTWF0Y2hUZXN0UGF0dGVybiA9ICcjXigoVy8pPyJbXHgwMC1ceDdmXSo/IiwgKSooVy8pPyJbXHgwMC1ceDdmXSo/IiQjJzsKJElmTm9uZU1hdGNoRXRhZ3NQYXR0ZXJuID0gJyMoPzpXLyk/KCJbXHgwMC1ceDdmXSo/IikoPz0kfCwgKD86Vy8pPyJbXHgwMC1ceDdmXSo/IikjJzsKCmlmICghcHJlZ19tYXRjaCgkSWZOb25lTWF0Y2hUZXN0UGF0dGVybiwgJGhlYWRlclZhbHVlKSkgewogICAgCiAgICB3cml0ZTJsb2coItCd0LXRgdGC0LDQvdC00LDRgNGC0L3Ri9C5IEV0YWcgJGhlYWRlclZhbHVlLiIsIEFERF9DTElFTlRfSEVBREVSUyk7ICAgICAgICAgICAgCiAgICAkaGVhZGVyRVRhZ3MgPSBhcnJheSgkaGVhZGVyVmFsdWUpOwogICAgCn0gZWxzZWlmIChwcmVnX21hdGNoX2FsbCgkSWZOb25lTWF0Y2hFdGFnc1BhdHRlcm4sICRoZWFkZXJWYWx1ZSwgJGhlYWRlckVUYWdzKSkgewogICAgCiAgICAkaGVhZGVyRVRhZ3MgPSAkaGVhZGVyRVRhZ3NbMV07IC8vINC/0LXRgNCy0LDRjyDQv9C+0LTQvNCw0YHQutCwCiAgICAKfSBlbHNlIHsKCgl3cml0ZTJsb2coIklmLU5vbmUtTWF0Y2gg0L/RgNC+0YjQtdC7INC/0YDQvtCy0LXRgNC60YMsINC90L4g0L3QtSDQtNCw0Lsg0YHQvtCy0L/QsNC00LXQvdC40LkuINCo0YLQsD8iLCBBRERfQ0xJRU5UX0hFQURFUlMpOwoJJGhlYWRlckVUYWdzID0gYXJyYXkoJGhlYWRlclZhbHVlKTsKCQp9