Skip to content

Commit fcee7e2

Browse files
author
Gildas Quéméner
committed
Hard-code sent timezone in If-Modified-Since header
If-Modified-Since format must be RFC850 compliant and in GMT timezone BUT PHP DATE_RFC850 format keep returning UTC timezone. So, we set the GMT timezone and force its rendering in the header.
1 parent d4a5cde commit fcee7e2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Github/HttpClient/CachedHttpClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ protected function createRequest($httpMethod, $url)
6767

6868
if ($modifiedAt = $this->getCache()->getModifiedSince($url)) {
6969
$modifiedAt = new \DateTime('@'.$modifiedAt);
70-
$modifiedAt->setTimezone(new \DateTimeZone('GMT'));
70+
$modifiedAt->setTimezone(new \DateTimeZone('GMT'));
7171

72-
$request->addHeader(sprintf('If-Modified-Since: %s', $modifiedAt->format(DATE_RFC2822)));
72+
$request->addHeader(sprintf('If-Modified-Since: %s GMT', $modifiedAt->format('l, d-M-y H:i:s')));
7373
}
7474

7575
return $request;

0 commit comments

Comments
 (0)