summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/nodejs/unit-http/unit.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/nodejs/unit-http/unit.cpp b/src/nodejs/unit-http/unit.cpp
index ebde01ce..3f66189a 100644
--- a/src/nodejs/unit-http/unit.cpp
+++ b/src/nodejs/unit-http/unit.cpp
@@ -376,18 +376,31 @@ Unit::create_headers(nxt_unit_request_info_t *req, napi_value request)
}
+inline char
+lowcase(char c)
+{
+ return (c >= 'A' && c <= 'Z') ? (c | 0x20) : c;
+}
+
+
inline void
Unit::append_header(nxt_unit_field_t *f, napi_value headers,
napi_value raw_headers, uint32_t idx)
{
- const char *name;
- napi_value str, vstr;
+ char *name;
+ uint8_t i;
+ napi_value str, vstr;
- name = (const char *) nxt_unit_sptr_get(&f->name);
+ name = (char *) nxt_unit_sptr_get(&f->name);
- vstr = set_named_property(headers, name, f->value, f->value_length);
str = create_string_latin1(name, f->name_length);
+ for (i = 0; i < f->name_length; i++) {
+ name[i] = lowcase(name[i]);
+ }
+
+ vstr = set_named_property(headers, name, f->value, f->value_length);
+
set_element(raw_headers, idx * 2, str);
set_element(raw_headers, idx * 2 + 1, vstr);
}