MediaWiki REL1_40
|
This is a parser for "HTTP-date" as defined by RFC 7231. More...
Inherits MediaWiki\Rest\HeaderParser\HeaderParserBase.
Static Public Member Functions | |
static | format ( $unixTime) |
A convenience function to convert a UNIX timestamp to the preferred IMF-fixdate format for HTTP header output. | |
static | parse ( $dateString) |
Parse an HTTP-date string. | |
Additional Inherited Members | |
Protected Member Functions inherited from MediaWiki\Rest\HeaderParser\HeaderParserBase | |
assertEnd () | |
If the position is not at the end of the input string, raise an error, complaining of trailing characters. | |
consumeFixedDigits ( $numDigits) | |
Consume a specified number of digits, or throw an exception. | |
consumeString ( $s) | |
Consume a specified string, or throw an exception. | |
error ( $message) | |
Throw an exception to indicate a parse error. | |
setInput ( $input) | |
Set the input, and derived convenience properties. | |
skipWhitespace () | |
Skip whitespace at the input position (OWS) | |
Protected Attributes inherited from MediaWiki\Rest\HeaderParser\HeaderParserBase | |
string | $input |
The input string being processed. | |
int | $inputLength |
The length of $input. | |
int | $pos |
The position within $input. | |
This is a parser for "HTTP-date" as defined by RFC 7231.
Normally in MediaWiki, dates in HTTP headers are converted using ConvertibleTimestamp or strtotime(), and this is encouraged by RFC 7231:
"Recipients of timestamp values are encouraged to be robust in parsing timestamps unless otherwise restricted by the field definition."
In the case of If-Modified-Since, we are in fact otherwise restricted, since RFC 7232 says:
"A recipient MUST ignore the If-Modified-Since header field if the received field-value is not a valid HTTP-date"
So it is not correct to use strtotime() or ConvertibleTimestamp to parse If-Modified-Since.
Definition at line 23 of file HttpDate.php.
|
static |
A convenience function to convert a UNIX timestamp to the preferred IMF-fixdate format for HTTP header output.
int | $unixTime |
Definition at line 96 of file HttpDate.php.
Referenced by MediaWiki\Rest\ConditionalHeaderUtil\applyResponseHeaders().
|
static |
Parse an HTTP-date string.
string | $dateString |
Definition at line 80 of file HttpDate.php.
Referenced by MediaWiki\Rest\ConditionalHeaderUtil\checkPreconditions().