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

View File

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