#include "config.h"
#include "config_components.h"
+#include <time.h>
#if CONFIG_ZLIB
#include <zlib.h>
#endif /* CONFIG_ZLIB */
static int cookie_string(AVDictionary *dict, char **cookies)
{
- AVDictionaryEntry *e = NULL;
+ const AVDictionaryEntry *e = NULL;
int len = 1;
// determine how much memory is needed for the cookies string
- while (e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))
+ while ((e = av_dict_iterate(dict, e)))
len += strlen(e->key) + strlen(e->value) + 1;
// reallocate the cookies
*cookies[0] = '\0';
// write out the cookies
- while (e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX))
+ while ((e = av_dict_iterate(dict, e)))
av_strlcatf(*cookies, len, "%s%s\n", e->key, e->value);
return 0;
}
} else if (!av_strcasecmp(tag, "Content-Type")) {
av_free(s->mime_type);
- s->mime_type = av_strdup(p);
+ s->mime_type = av_get_token((const char **)&p, ";");
} else if (!av_strcasecmp(tag, "Set-Cookie")) {
if (parse_cookie(s, p, &s->cookie_dict))
av_log(h, AV_LOG_WARNING, "Unable to parse '%s'\n", p);
goto skip_cookie;
}
- // ensure this cookie matches the path
+ // if a cookie path is provided, ensure the request path is within that path
e = av_dict_get(cookie_params, "path", NULL, 0);
- if (!e || av_strncasecmp(path, e->value, strlen(e->value)))
+ if (e && av_strncasecmp(path, e->value, strlen(e->value)))
goto skip_cookie;
// cookie parameters match, so copy the value