33 const char *pos = header_value;
35 lwc_string *subtype = NULL;
54 lwc_string_unref(
type);
64 lwc_string_unref(
type);
74 lwc_string_unref(subtype);
75 lwc_string_unref(
type);
81 mime_len = lwc_string_length(
type) + lwc_string_length(subtype) + 1;
83 mime = malloc(mime_len + 1);
86 lwc_string_unref(subtype);
87 lwc_string_unref(
type);
91 sprintf(mime,
"%.*s/%.*s",
92 (
int) lwc_string_length(
type), lwc_string_data(
type),
93 (
int) lwc_string_length(subtype), lwc_string_data(subtype));
95 lwc_string_unref(subtype);
96 lwc_string_unref(
type);
98 if (lwc_intern_string(mime, mime_len, &imime) != lwc_error_ok) {
106 ct = malloc(
sizeof(*ct));
108 lwc_string_unref(imime);
nserror http_parse_content_type(const char *header_value, http_content_type **result)
Parse an HTTP Content-Type header value.
void http_content_type_destroy(http_content_type *victim)
Destroy a content type object.
nserror
Enumeration of error codes.
@ NSERROR_NOT_FOUND
Requested item not found.
@ NSERROR_NOMEM
Memory exhaustion.
#define http__item_list_parse(i, p, f, r)
HTTP header parsing functions.
void http_parameter_list_destroy(http_parameter *list)
Destroy a list of HTTP parameters.
nserror http__parse_parameter(const char **input, http_parameter **parameter)
Parse an HTTP parameter.
nserror http__parse_token(const char **input, lwc_string **value)
Parse an HTTP token.
void http__skip_LWS(const char **input)
Skip past linear whitespace in input.
Interface to utility string handling.
http_parameter * parameters
Representation of an HTTP parameter.