static int http_date_parse_format_imf_fixdate(struct http_date_parser *parser) { /* IMF-fixdate = day-name "," SP date1 SP time-of-day SP GMT ; fixed length/zone/capitalization subset of the format ; see Section 3.3 of [RFC5322] date1 = day SP month SP year ; e.g., 02 Jun 1982 Remaining: {...} SP day SP month SP year SP time-of-day SP GMT */ /* SP day */ if (http_date_parse_sp(parser) <= 0) return -1; if (http_date_parse_day(parser) <= 0) return -1; /* SP month */ if (http_date_parse_sp(parser) <= 0) return -1; if (http_date_parse_month(parser) <= 0) return -1; /* SP year */ if (http_date_parse_sp(parser) <= 0) return -1; if (http_date_parse_year(parser) <= 0) return -1; /* SP time-of-day SP GMT */ return http_date_parse_time_gmt(parser); }
static int http_date_parse_format_rfc1123(struct http_date_parser *parser) { /* rfc1123-date = day-name "," SP date1 SP time-of-day SP GMT ; fixed length subset of the format defined in ; Section 5.2.14 of [RFC1123] date1 = day SP month SP year ; e.g., 02 Jun 1982 Remaining: {...} SP day SP month SP year SP time-of-day SP GMT */ /* SP day */ if (http_date_parse_sp(parser) <= 0) return -1; if (http_date_parse_day(parser) <= 0) return -1; /* SP month */ if (http_date_parse_sp(parser) <= 0) return -1; if (http_date_parse_month(parser) <= 0) return -1; /* SP year */ if (http_date_parse_sp(parser) <= 0) return -1; if (http_date_parse_year(parser) <= 0) return -1; /* SP time-of-day SP GMT */ return http_date_parse_time_gmt(parser); }
static int http_date_parse_format_rfc850(struct http_date_parser *parser) { /* rfc850-date = day-name-l "," SP date2 SP time-of-day SP GMT date2 = day "-" month "-" 2DIGIT ; day-month-year (e.g., 02-Jun-82) Remaining: "," SP day "-" month "-" 2DIGIT SP time-of-day SP GMT */ /* "," SP */ if (parser->cur >= parser->end || parser->cur[0] != ',') return -1; parser->cur++; if (http_date_parse_sp(parser) <= 0) return -1; /* day */ if (http_date_parse_day(parser) <= 0) return -1; /* "-" */ if (parser->cur >= parser->end || parser->cur[0] != '-') return -1; parser->cur++; /* month */ if (http_date_parse_month(parser) <= 0) return -1; /* "-" */ if (parser->cur >= parser->end || parser->cur[0] != '-') return -1; parser->cur++; /* 2DIGIT */ if (http_date_parse_number(parser, 2, &parser->tm.tm_year) <= 0) return -1; if (parser->tm.tm_year < 70) parser->tm.tm_year += 100; /* SP time-of-day SP GMT */ return http_date_parse_time_gmt(parser); }