Browse Source

[mod_deflate] ignore '*' in deflate.mimetypes

mod_deflate performs prefix match of deflate.mimetypes against the
response Content-Type.  Therefore "text/" will make all text/*
mimetypes.  This commit permits admin to specify "text/*" in
  deflate.mimetypes = ("text/*")
and mod_deflate will treat it as "text/".  This is done only when the
'*' is the last char in the mimetype.
personal/stbuehler/mod-csrf
Glenn Strauss 5 years ago
parent
commit
aef6207965
  1. 11
      src/mod_deflate.c

11
src/mod_deflate.c

@ -352,6 +352,17 @@ SETDEFAULTS_FUNC(mod_deflate_setdefaults) {
| HTTP_ACCEPT_ENCODING_X_BZIP2;
#endif
}
/* mod_deflate matches mimetype as prefix of Content-Type
* so ignore '*' at end of mimetype for end-user flexibility
* in specifying trailing wildcard to grouping of mimetypes */
for (size_t m = 0; m < s->mimetypes->used; ++m) {
buffer *mimetype = ((data_string *)s->mimetypes->data[m])->value;
size_t len = buffer_string_length(mimetype);
if (len > 2 && mimetype->ptr[len-1] == '*') {
buffer_string_set_length(mimetype, len-1);
}
}
}
return HANDLER_GO_ON;

Loading…
Cancel
Save