32#define WHITESPACES " \n\t\r"
36 return c == 0x09 || (
c >= 0x20 &&
c <= 0x2F) || (
c >= 0x3B &&
c <= 0x40) ||
37 (
c >= 0x5B &&
c <= 0x60) || (
c >= 0x7B &&
c <= 0x7E);
46 *
val = *
val * 10 + str[n] -
'0';
54 return (n =
parse_digits(str, 1, 2, &tm->tm_hour)) && str[n++] ==
':' &&
55 (m =
parse_digits(str + n, 1, 2, &tm->tm_min)) && str[n + m++] ==
':' &&
61 static const char months[] =
"janfebmaraprmayjunjulaugsepoctnovdec";
63 for (
int i = 0;
i < 12;
i++)
71 static const uint8_t month_days[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
72 int found_time = 0, found_day = 0, found_month = 0, found_year = 0, month, year;
81 if (!found_time &&
parse_time(date_str, &tm)) {
83 }
else if (!found_day &&
parse_digits(date_str, 1, 2, &tm.tm_mday)) {
85 }
else if (!found_month && (month =
parse_month(date_str)) >= 0) {
88 }
else if (!found_year &&
parse_digits(date_str, 2, 4, &year)) {
95 if (!found_time || !found_day || !found_month || !found_year)
97 year += year < 70 ? 2000 : year < 100 ? 1900 : 0;
98 if (year < 1601 || tm.tm_hour > 23 || tm.tm_min > 59 || tm.tm_sec > 59 ||
99 tm.tm_mday < 1 || tm.tm_mday > month_days[tm.tm_mon] ||
100 (tm.tm_mon == 1 && tm.tm_mday == 29 && (year % 4 || (year % 100 == 0 && year % 400))))
102 tm.tm_year = year - 1900;
112 end = str + strlen(str);
121 if (((uint8_t)*str < 0x20 && *str !=
'\t') || *str == 0x7f)
129 return *str && !str[strspn(str,
"0123456789")];
134 char *param, *next_param, *cstr, *eql;
135 char *saveptr =
NULL;
149 next_param = strchr(param,
';');
151 *next_param++ =
'\0';
152 if (!(eql = strchr(param,
'=')) || eql == param) {
159 while (
ret >= 0 && (param =
av_strtok(next_param,
";", &saveptr))) {
160 char *
value = strchr(param,
'=');
184 return !
host[strspn(
host,
"0123456789.")] || strchr(
host,
':');
190 const char *domain = e ? e->
value + (e->
value[0] ==
'.') :
"";
192 return *domain ? domain :
NULL;
199 struct tm tm = { 0 };
222 while ((cookie =
av_strtok(next,
"\n", &saveptr))) {
224 int len = strlen(cookie), host_only;
236 av_bprintf(&bp,
"%.*s%s%s\n",
len, cookie, host_only ?
"; @hostonly=" :
"", host_only ?
host :
"");
SwsAArch64OpImplParams params
static double val(void *priv, double ch)
static double bound(const double threshold, const double val)
static const char months[12][4]
void av_bprintf(AVBPrint *buf, const char *fmt,...)
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define AV_BPRINT_SIZE_UNLIMITED
#define i(width, name, range_min, range_max)
common internal and external API header
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok().
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
static av_const int av_isdigit(int c)
Locale-independent conversion of ASCII isdigit.
int av_strncasecmp(const char *a, const char *b, size_t n)
Locale-independent case-insensitive compare.
const char * ff_http_cookie_domain(const AVDictionary *cookie_params)
static int parse_month(const char *str)
int ff_http_host_is_ip_literal(const char *host)
static int parse_digits(const char *str, int min, int max, int *val)
static int is_date_delimiter(uint8_t c)
int64_t ff_http_cookie_expiry(const AVDictionary *attributes)
static char * trim(char *str)
int ff_http_parse_set_cookie(const char *set_cookie, AVDictionary **cookie, AVDictionary **attributes)
Parse a Set-Cookie style line.
int ff_http_parse_date(const char *date_str, struct tm *buf)
Parse an HTTP date like "Wed, 21 Oct 2015 07:28:00 GMT".
static int has_control_char(const char *str)
static int parse_time(const char *str, struct tm *tm)
int ff_http_bind_cookies_to_host(char **cookies, const char *host)
Restrict the cookies without a Domain to host.
static int is_delta_seconds(const char *str)
Memory handling functions.
time_t av_timegm(struct tm *tm)
Convert the decomposed UTC time in tm to a time_t value, saturated to the range of time_t.
static const char *const cookies[]
static void copy(const float *p1, float *p2, const int length)