nghttpx: Don't capitalize h1 header fields
This commit is contained in:
parent
44e290da66
commit
f994664934
13
src/http2.cc
13
src/http2.cc
|
@ -238,17 +238,6 @@ StringRef stringify_status(BlockAllocator &balloc, unsigned int status_code) {
|
|||
}
|
||||
}
|
||||
|
||||
void capitalize(DefaultMemchunks *buf, const StringRef &s) {
|
||||
buf->append(util::upcase(s[0]));
|
||||
for (size_t i = 1; i < s.size(); ++i) {
|
||||
if (s[i - 1] == '-') {
|
||||
buf->append(util::upcase(s[i]));
|
||||
} else {
|
||||
buf->append(s[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool lws(const char *value) {
|
||||
for (; *value; ++value) {
|
||||
switch (*value) {
|
||||
|
@ -417,7 +406,7 @@ void build_http1_headers_from_headers(DefaultMemchunks *buf,
|
|||
case HD_X_FORWARDED_PROTO:
|
||||
continue;
|
||||
}
|
||||
capitalize(buf, kv.name);
|
||||
buf->append(kv.name);
|
||||
buf->append(": ");
|
||||
buf->append(kv.value);
|
||||
buf->append("\r\n");
|
||||
|
|
|
@ -101,8 +101,6 @@ StringRef get_reason_phrase(unsigned int status_code);
|
|||
// Returns string version of |status_code|. (e.g., "404")
|
||||
StringRef stringify_status(BlockAllocator &balloc, unsigned int status_code);
|
||||
|
||||
void capitalize(DefaultMemchunks *buf, const StringRef &s);
|
||||
|
||||
// Returns true if |value| is LWS
|
||||
bool lws(const char *value);
|
||||
|
||||
|
|
|
@ -187,15 +187,15 @@ void test_http2_build_http1_headers_from_headers(void) {
|
|||
DefaultMemchunks buf(&pool);
|
||||
http2::build_http1_headers_from_headers(&buf, headers);
|
||||
auto hdrs = std::string(buf.head->pos, buf.head->last);
|
||||
CU_ASSERT("Alpha: 0\r\n"
|
||||
"Bravo: 1\r\n"
|
||||
"Delta: 4\r\n"
|
||||
"Expect: 5\r\n"
|
||||
"Foxtrot: 6\r\n"
|
||||
"Tango: 7\r\n"
|
||||
"Te: 8\r\n"
|
||||
"Te: 9\r\n"
|
||||
"Zulu: 12\r\n" == hdrs);
|
||||
CU_ASSERT("alpha: 0\r\n"
|
||||
"bravo: 1\r\n"
|
||||
"delta: 4\r\n"
|
||||
"expect: 5\r\n"
|
||||
"foxtrot: 6\r\n"
|
||||
"tango: 7\r\n"
|
||||
"te: 8\r\n"
|
||||
"te: 9\r\n"
|
||||
"zulu: 12\r\n" == hdrs);
|
||||
}
|
||||
|
||||
void test_http2_lws(void) {
|
||||
|
|
|
@ -890,7 +890,7 @@ int HttpsUpstream::send_reply(Downstream *downstream, const uint8_t *body,
|
|||
if (kv.name.empty() || kv.name[0] == ':') {
|
||||
continue;
|
||||
}
|
||||
http2::capitalize(output, kv.name);
|
||||
output->append(kv.name);
|
||||
output->append(": ");
|
||||
output->append(kv.value);
|
||||
output->append("\r\n");
|
||||
|
|
Loading…
Reference in New Issue