Browse Source
This involved multiple fixes to Picofeed itself, not all of which have been merged upstream yetrpm
J. King
4 years ago
11 changed files with 74 additions and 27 deletions
@ -0,0 +1,23 @@ |
|||
<?php |
|||
// this test returns 400 rather than 304 if the values of If-Modified-Since |
|||
// and If-None-Match doesn't match $G_GET['t'] and $_GET['e'] respectively, or |
|||
// if the $_GET members are missing |
|||
if ( |
|||
!($_GET['t'] ?? "") || |
|||
!($_GET['e'] ?? "") || |
|||
($_SERVER['HTTP_IF_MODIFIED_SINCE'] ?? "") !== gmdate("D, d M Y H:i:s \G\M\T", (int) $_GET['t']) || |
|||
($_SERVER['HTTP_IF_NONE_MATCH'] ?? "") !== $_GET['e'] |
|||
) { |
|||
return [ |
|||
'code' => 400, |
|||
]; |
|||
} else { |
|||
return [ |
|||
'code' => 304, |
|||
'lastMod' => random_int(0, 2^31), |
|||
'fields' => [ |
|||
"ETag: ".bin2hex(random_bytes(8)), |
|||
], |
|||
]; |
|||
} |
|||
|
Loading…
Reference in new issue