diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2016-10-09 09:43:46 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2016-10-09 09:43:46 +0200 |
commit | a34ce0b6b83602e3046a3b62f2670db818954998 (patch) | |
tree | 7ef50d5d5629dbe032a545abc7938f87b0cbce62 | |
parent | ad143fd8c06f2d46559e99c54fa2b611a25e3cc9 (diff) | |
download | liberty-a34ce0b6b83602e3046a3b62f2670db818954998.tar.gz liberty-a34ce0b6b83602e3046a3b62f2670db818954998.tar.xz liberty-a34ce0b6b83602e3046a3b62f2670db818954998.zip |
Allow ignoring params in http_parse_media_type()
-rw-r--r-- | liberty-proto.c | 8 |
1 files 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) |