MediaWiki REL1_37
|
This is a parser for "HTTP-date" as defined by RFC 7231. More...
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. | |
Private Member Functions | |
__construct ( $input) | |
Private constructor. | |
consumeAsctimeDate () | |
Execute the asctime-date rule. | |
consumeDate1 () | |
Execute the date1 rule. | |
consumeDate2 () | |
Execute the date2 rule. | |
consumeDate3 () | |
Execute the date3 rule. | |
consumeDay () | |
Execute the day rule, and capture the result. | |
consumeDayName () | |
Execute the day-name rule, and capture the result. | |
consumeDayNameLong () | |
Execute the day-name-l rule. | |
consumeFixdate () | |
Execute the IMF-fixdate rule, or throw an exception. | |
consumeMonth () | |
Execute the month rule, and capture the result. | |
consumeRfc850Date () | |
Execute the rfc850-date rule. | |
consumeTimeOfDay () | |
Execute the time-of-day rule. | |
consumeYear () | |
Execute the year rule, and capture the result. | |
execute () | |
Parse the input string. | |
getUnixTime () | |
Convert the captured results to a UNIX timestamp. | |
Private Attributes | |
$day | |
$dayName | |
$hour | |
$minute | |
$month | |
$second | |
$year | |
Static Private Attributes | |
static | $dayNames |
static | $dayNamesLong |
static | $monthsByName |
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.
|
private |
Private constructor.
Use the public static functions for public access.
string | $input |
Definition at line 98 of file HttpDate.php.
References MediaWiki\Rest\HeaderParser\HeaderParserBase\$input, and MediaWiki\Rest\HeaderParser\HeaderParserBase\setInput().
|
private |
Execute the asctime-date rule.
HeaderParserError |
Definition at line 275 of file HttpDate.php.
References MediaWiki\Rest\HeaderParser\HttpDate\consumeDate3(), MediaWiki\Rest\HeaderParser\HttpDate\consumeDayName(), MediaWiki\Rest\HeaderParser\HeaderParserBase\consumeString(), MediaWiki\Rest\HeaderParser\HttpDate\consumeTimeOfDay(), and MediaWiki\Rest\HeaderParser\HttpDate\consumeYear().
Referenced by MediaWiki\Rest\HeaderParser\HttpDate\execute().
|
private |
Execute the date1 rule.
HeaderParserError |
Definition at line 166 of file HttpDate.php.
References MediaWiki\Rest\HeaderParser\HttpDate\consumeDay(), MediaWiki\Rest\HeaderParser\HttpDate\consumeMonth(), MediaWiki\Rest\HeaderParser\HeaderParserBase\consumeString(), and MediaWiki\Rest\HeaderParser\HttpDate\consumeYear().
Referenced by MediaWiki\Rest\HeaderParser\HttpDate\consumeFixdate().
|
private |
Execute the date2 rule.
HeaderParserError |
Definition at line 238 of file HttpDate.php.
References MediaWiki\Rest\HeaderParser\HttpDate\$month, MediaWiki\Rest\HeaderParser\HttpDate\$year, MediaWiki\Rest\HeaderParser\HttpDate\consumeDay(), MediaWiki\Rest\HeaderParser\HeaderParserBase\consumeFixedDigits(), MediaWiki\Rest\HeaderParser\HttpDate\consumeMonth(), and MediaWiki\Rest\HeaderParser\HeaderParserBase\consumeString().
Referenced by MediaWiki\Rest\HeaderParser\HttpDate\consumeRfc850Date().
|
private |
Execute the date3 rule.
HeaderParserError |
Definition at line 290 of file HttpDate.php.
References MediaWiki\Rest\HeaderParser\HttpDate\$month, MediaWiki\Rest\HeaderParser\HeaderParserBase\consumeFixedDigits(), MediaWiki\Rest\HeaderParser\HttpDate\consumeMonth(), and MediaWiki\Rest\HeaderParser\HeaderParserBase\consumeString().
Referenced by MediaWiki\Rest\HeaderParser\HttpDate\consumeAsctimeDate().
|
private |
Execute the day rule, and capture the result.
HeaderParserError |
Definition at line 179 of file HttpDate.php.
References MediaWiki\Rest\HeaderParser\HttpDate\$month, and MediaWiki\Rest\HeaderParser\HeaderParserBase\consumeFixedDigits().
Referenced by MediaWiki\Rest\HeaderParser\HttpDate\consumeDate1(), and MediaWiki\Rest\HeaderParser\HttpDate\consumeDate2().
|
private |
Execute the day-name rule, and capture the result.
HeaderParserError |
Definition at line 151 of file HttpDate.php.
References MediaWiki\Rest\HeaderParser\HttpDate\$month, and MediaWiki\Rest\HeaderParser\HeaderParserBase\error().
Referenced by MediaWiki\Rest\HeaderParser\HttpDate\consumeAsctimeDate(), and MediaWiki\Rest\HeaderParser\HttpDate\consumeFixdate().
|
private |
Execute the day-name-l rule.
HeaderParserError |
Definition at line 259 of file HttpDate.php.
References MediaWiki\Rest\HeaderParser\HttpDate\$dayName, MediaWiki\Rest\HeaderParser\HttpDate\$month, and MediaWiki\Rest\HeaderParser\HeaderParserBase\error().
Referenced by MediaWiki\Rest\HeaderParser\HttpDate\consumeRfc850Date().
|
private |
Execute the IMF-fixdate rule, or throw an exception.
HeaderParserError |
Definition at line 137 of file HttpDate.php.
References MediaWiki\Rest\HeaderParser\HttpDate\consumeDate1(), MediaWiki\Rest\HeaderParser\HttpDate\consumeDayName(), MediaWiki\Rest\HeaderParser\HeaderParserBase\consumeString(), and MediaWiki\Rest\HeaderParser\HttpDate\consumeTimeOfDay().
Referenced by MediaWiki\Rest\HeaderParser\HttpDate\execute().
|
private |
Execute the month rule, and capture the result.
HeaderParserError |
Definition at line 188 of file HttpDate.php.
References MediaWiki\Rest\HeaderParser\HttpDate\$month, and MediaWiki\Rest\HeaderParser\HeaderParserBase\error().
Referenced by MediaWiki\Rest\HeaderParser\HttpDate\consumeDate1(), MediaWiki\Rest\HeaderParser\HttpDate\consumeDate2(), and MediaWiki\Rest\HeaderParser\HttpDate\consumeDate3().
|
private |
Execute the rfc850-date rule.
HeaderParserError |
Definition at line 224 of file HttpDate.php.
References MediaWiki\Rest\HeaderParser\HttpDate\consumeDate2(), MediaWiki\Rest\HeaderParser\HttpDate\consumeDayNameLong(), MediaWiki\Rest\HeaderParser\HeaderParserBase\consumeString(), and MediaWiki\Rest\HeaderParser\HttpDate\consumeTimeOfDay().
Referenced by MediaWiki\Rest\HeaderParser\HttpDate\execute().
|
private |
Execute the time-of-day rule.
HeaderParserError |
Definition at line 211 of file HttpDate.php.
References MediaWiki\Rest\HeaderParser\HttpDate\$month, MediaWiki\Rest\HeaderParser\HeaderParserBase\consumeFixedDigits(), and MediaWiki\Rest\HeaderParser\HeaderParserBase\consumeString().
Referenced by MediaWiki\Rest\HeaderParser\HttpDate\consumeAsctimeDate(), MediaWiki\Rest\HeaderParser\HttpDate\consumeFixdate(), and MediaWiki\Rest\HeaderParser\HttpDate\consumeRfc850Date().
|
private |
Execute the year rule, and capture the result.
HeaderParserError |
Definition at line 203 of file HttpDate.php.
References MediaWiki\Rest\HeaderParser\HttpDate\$month, and MediaWiki\Rest\HeaderParser\HeaderParserBase\consumeFixedDigits().
Referenced by MediaWiki\Rest\HeaderParser\HttpDate\consumeAsctimeDate(), and MediaWiki\Rest\HeaderParser\HttpDate\consumeDate1().
|
private |
Parse the input string.
Definition at line 107 of file HttpDate.php.
References MediaWiki\Rest\HeaderParser\HttpDate\$month, MediaWiki\Rest\HeaderParser\HeaderParserBase\assertEnd(), MediaWiki\Rest\HeaderParser\HttpDate\consumeAsctimeDate(), MediaWiki\Rest\HeaderParser\HttpDate\consumeFixdate(), and MediaWiki\Rest\HeaderParser\HttpDate\consumeRfc850Date().
|
static |
A convenience function to convert a UNIX timestamp to the preferred IMF-fixdate format for HTTP header output.
int | $unixTime |
Definition at line 89 of file HttpDate.php.
References MediaWiki\Rest\HeaderParser\HttpDate\$month.
Referenced by MediaWiki\Rest\ConditionalHeaderUtil\applyResponseHeaders().
|
private |
Convert the captured results to a UNIX timestamp.
This should only be called after parsing succeeds.
Definition at line 307 of file HttpDate.php.
References MediaWiki\Rest\HeaderParser\HttpDate\$month.
|
static |
Parse an HTTP-date string.
string | $dateString |
Definition at line 73 of file HttpDate.php.
References MediaWiki\Rest\HeaderParser\HttpDate\$month.
Referenced by MediaWiki\Rest\ConditionalHeaderUtil\checkPreconditions().
|
private |
Definition at line 60 of file HttpDate.php.
|
private |
Definition at line 59 of file HttpDate.php.
Referenced by MediaWiki\Rest\HeaderParser\HttpDate\consumeDayNameLong().
|
staticprivate |
Definition at line 24 of file HttpDate.php.
|
staticprivate |
Definition at line 49 of file HttpDate.php.
|
private |
Definition at line 63 of file HttpDate.php.
|
private |
Definition at line 64 of file HttpDate.php.
|
private |
Definition at line 61 of file HttpDate.php.
Referenced by MediaWiki\Rest\HeaderParser\HttpDate\consumeDate2(), MediaWiki\Rest\HeaderParser\HttpDate\consumeDate3(), MediaWiki\Rest\HeaderParser\HttpDate\consumeDay(), MediaWiki\Rest\HeaderParser\HttpDate\consumeDayName(), MediaWiki\Rest\HeaderParser\HttpDate\consumeDayNameLong(), MediaWiki\Rest\HeaderParser\HttpDate\consumeMonth(), MediaWiki\Rest\HeaderParser\HttpDate\consumeTimeOfDay(), MediaWiki\Rest\HeaderParser\HttpDate\consumeYear(), MediaWiki\Rest\HeaderParser\HttpDate\execute(), MediaWiki\Rest\HeaderParser\HttpDate\format(), MediaWiki\Rest\HeaderParser\HttpDate\getUnixTime(), and MediaWiki\Rest\HeaderParser\HttpDate\parse().
|
staticprivate |
Definition at line 34 of file HttpDate.php.
|
private |
Definition at line 65 of file HttpDate.php.
|
private |
Definition at line 62 of file HttpDate.php.
Referenced by MediaWiki\Rest\HeaderParser\HttpDate\consumeDate2().