diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2022-05-26 01:32:23 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2022-05-26 01:34:38 -0400 |
commit | 33f73b4d821a3cd09614533d592f102166963cc5 (patch) | |
tree | fff206ecdc6435877e40948d45fada69ea4663ee /src/http-header-glue.c | |
parent | a6d4a98c07f68aa8a41965daffd2cd78fb7737fd (diff) | |
download | lighttpd-git-33f73b4d821a3cd09614533d592f102166963cc5.tar.gz |
[multiple] application/javascript text/javascript
translate MIME type "application/javascript" to "text/javascript"
(if required, type may still be overwritten by mod_setenv or mod_magnet)
x-ref:
"Updates to ECMAScript Media Types"
https://www.rfc-editor.org/rfc/rfc9239
Diffstat (limited to 'src/http-header-glue.c')
-rw-r--r-- | src/http-header-glue.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/http-header-glue.c b/src/http-header-glue.c index 63e67dfd..d873c2ff 100644 --- a/src/http-header-glue.c +++ b/src/http-header-glue.c @@ -962,6 +962,16 @@ static int http_response_process_headers(request_st * const restrict r, http_res r->keep_alive = 0; if (r->http_version >= HTTP_VERSION_2) continue; break; + case HTTP_HEADER_CONTENT_TYPE: + if (end - value >= 22 /*(prefix match probably good enough)*/ + && 0 == memcmp(value, "application/javascript", 22)) { + /* value = "text/javascript"; *//*(loses ";charset=...")*/ + /* *(const char **)&end = value+sizeof("text/javascript")-1; */ + /*(convert "application/javascript" to "text/javascript")*/ + value += 7; /*(step over "applica", leaving "tion")*/ + memcpy(s+(value-s)+1, "ext", 3); + } + break; case HTTP_HEADER_CONTENT_LENGTH: if (*value == '+') ++value; if (!r->resp_decode_chunked |