Boost C++ Libraries

PrevUpHomeNext

Function parse_http_date

boost::taar::parse_http_date — Parse an HTTP-date (RFC 9110 5.6.7).

Synopsis

// In header: <boost/taar/core/http_date.hpp>


std::optional< std::chrono::sys_seconds > 
parse_http_date(std::string_view text);

Description

Accepts the preferred IMF-fixdate (Sun, 06 Nov 1994 08:49:37 GMT) and the two obsolete forms a recipient must accept: RFC 850 (Sunday, 06-Nov-94 08:49:37 GMT) and asctime (Sun Nov 6 08:49:37 1994). A two-digit RFC 850 year that would lie more than 50 years in the future is taken as the most recent past year with the same last two digits. The day name is checked for form, not for consistency with the date.

Returns:

The instant, or std::nullopt if text is not an HTTP-date.


PrevUpHomeNext