From a34ce0b6b83602e3046a3b62f2670db818954998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Sun, 9 Oct 2016 09:43:46 +0200 Subject: Allow ignoring params in http_parse_media_type() --- liberty-proto.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/liberty-proto.c b/liberty-proto.c index 1b5d53f..5e84b21 100644 --- a/liberty-proto.c +++ b/liberty-proto.c @@ -409,7 +409,8 @@ http_parse_media_type_parameter { case HTTP_T_TOKEN: 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; default: break; @@ -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) -- cgit v1.2.3