From 9c8b9ff010e77b0c9ccb64a5e50aaee551f5598a Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Thu, 18 Mar 2021 20:42:14 -0400 Subject: [PATCH] [core] move special case for Content-Type CGI hdr move special case for Content-Type CGI header to identify header with tag rather than string comparison --- src/http_cgi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/http_cgi.c b/src/http_cgi.c index 5235fa67..cc10f73d 100644 --- a/src/http_cgi.c +++ b/src/http_cgi.c @@ -98,10 +98,12 @@ http_cgi_encode_varname (buffer * const b, const char * const restrict s, const size_t i, j = 0; if (is_http_header) { + #if 0 /*(special-cased in caller that sets is_http_header)*/ if (len == 12 && buffer_eq_icase_ssn(s, "Content-Type", 12)) { buffer_copy_string_len(b, CONST_STR_LEN("CONTENT_TYPE")); return; } + #endif memcpy(p, "HTTP_", 5); j = 5; /* "HTTP_" */ } @@ -331,7 +333,10 @@ http_cgi_headers (request_st * const r, http_cgi_opts * const opts, http_cgi_hea && buffer_eq_icase_slen(&ds->key, CONST_STR_LEN("Proxy"))) { continue; } - http_cgi_encode_varname(tb, CONST_BUF_LEN(&ds->key), 1); + else if (ds->ext == HTTP_HEADER_CONTENT_TYPE) + buffer_copy_string_len(tb, CONST_STR_LEN("CONTENT_TYPE")); + else + http_cgi_encode_varname(tb, CONST_BUF_LEN(&ds->key), 1); rc |= cb(vdata, CONST_BUF_LEN(tb), CONST_BUF_LEN(&ds->value)); }