Allow ignoring params in http_parse_media_type()

This commit is contained in:
Přemysl Eric Janouch 2016-10-09 09:43:46 +02:00
parent ad143fd8c0
commit a34ce0b6b8
Signed by: p
GPG Key ID: B715679E3A361BE6
1 changed files with 5 additions and 3 deletions

View File

@ -409,6 +409,7 @@ http_parse_media_type_parameter
{
case HTTP_T_TOKEN:
case HTTP_T_QUOTED_STRING:
if (parameters)
str_map_set (parameters, attribute, xstrdup (t->string.str));
result = true;
default:
@ -420,8 +421,9 @@ end:
return result;
}
/// Parser for "Content-Type". @a type and @a subtype may be non-NULL
/// even if the function fails. @a parameters should be case-insensitive.
/// Parser for "Content-Type". @a type and @a subtype may end up non-NULL
/// even if the function fails. @a parameters should be case-insensitive,
/// and may be NULL for validation only.
static bool
http_parse_media_type (const char *media_type,
char **type, char **subtype, struct str_map *parameters)