| 987 | } |
| 988 | |
| 989 | static int parse_http_date(const char *date_str, struct tm *buf) |
| 990 | { |
| 991 | char date_buf[MAX_DATE_LEN]; |
| 992 | int i, j, date_buf_len = MAX_DATE_LEN-1; |
| 993 | char *date; |
| 994 | |
| 995 | // strip off any punctuation or whitespace |
| 996 | for (i = 0, j = 0; date_str[i] != '\0' && j < date_buf_len; i++) { |
| 997 | if ((date_str[i] >= '0' && date_str[i] <= '9') || |
| 998 | (date_str[i] >= 'A' && date_str[i] <= 'Z') || |
| 999 | (date_str[i] >= 'a' && date_str[i] <= 'z')) { |
| 1000 | date_buf[j] = date_str[i]; |
| 1001 | j++; |
| 1002 | } |
| 1003 | } |
| 1004 | date_buf[j] = '\0'; |
| 1005 | date = date_buf; |
| 1006 | |
| 1007 | // move the string beyond the day of week |
| 1008 | while ((*date < '0' || *date > '9') && *date != '\0') |
| 1009 | date++; |
| 1010 | |
| 1011 | return av_small_strptime(date, "%d%b%Y%H%M%S", buf) ? 0 : AVERROR(EINVAL); |
| 1012 | } |
| 1013 | |
| 1014 | static int parse_set_cookie(const char *set_cookie, AVDictionary **dict) |
| 1015 | { |
no test coverage detected