semantics of ngx_http_test_content_type when the Content-Type contains a charset?

Brian Pane brianp at brianp.net
Fri Feb 19 11:06:26 MSK 2010


If an HTTP response has a Content-Type with a charset, like this:
  Content-Type: text/html; charset=utf-8
the ngx_http_test_content_type function tries to match the entire
header value, including the "charset=utf-8" part, against the supplied
types hash.  If the hash contains just "text/html" the "text/html;
charset=utf-8" won't match, and ngx_http_test_content_type will return
null.

Is that intentional, or should ngx_http_test_content_type only
consider the part of the content-type before the ';'?

I can think of arguments both for and against the current behavior,
but my question is: is this behavior considered intentional, or is it
a bug?

Thanks,
-Brian



More information about the nginx-devel mailing list