Commit 9678daa4 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Rename index_headers() as parse_content_length()

parent 23ecfd41
...@@ -367,7 +367,7 @@ void append_last_header_value(bool &key_prev, size_t &sum, Headers &headers, ...@@ -367,7 +367,7 @@ void append_last_header_value(bool &key_prev, size_t &sum, Headers &headers,
} }
} // namespace } // namespace
int FieldStore::index_headers() { int FieldStore::parse_content_length() {
content_length = -1; content_length = -1;
for (auto &kv : headers_) { for (auto &kv : headers_) {
......
...@@ -89,10 +89,9 @@ public: ...@@ -89,10 +89,9 @@ public:
bool header_key_prev() const { return header_key_prev_; } bool header_key_prev() const { return header_key_prev_; }
// Lower the header field names and indexes header fields. If there // Parses content-length, and records it in the field. If there are
// is any invalid headers (e.g., multiple Content-Length having // multiple Content-Length, returns -1.
// different values), returns -1. int parse_content_length();
int index_headers();
// Empties headers. // Empties headers.
void clear_headers(); void clear_headers();
......
...@@ -572,7 +572,7 @@ int htp_hdrs_completecb(http_parser *htp) { ...@@ -572,7 +572,7 @@ int htp_hdrs_completecb(http_parser *htp) {
resp.http_major = htp->http_major; resp.http_major = htp->http_major;
resp.http_minor = htp->http_minor; resp.http_minor = htp->http_minor;
if (resp.fs.index_headers() != 0) { if (resp.fs.parse_content_length() != 0) {
downstream->set_response_state(Downstream::MSG_BAD_HEADER); downstream->set_response_state(Downstream::MSG_BAD_HEADER);
return -1; return -1;
} }
......
...@@ -270,7 +270,7 @@ int htp_hdrs_completecb(http_parser *htp) { ...@@ -270,7 +270,7 @@ int htp_hdrs_completecb(http_parser *htp) {
ULOG(INFO, upstream) << "HTTP request headers\n" << ss.str(); ULOG(INFO, upstream) << "HTTP request headers\n" << ss.str();
} }
if (req.fs.index_headers() != 0) { if (req.fs.parse_content_length() != 0) {
return -1; return -1;
} }
......
...@@ -194,7 +194,7 @@ void on_ctrl_recv_callback(spdylay_session *session, spdylay_frame_type type, ...@@ -194,7 +194,7 @@ void on_ctrl_recv_callback(spdylay_session *session, spdylay_frame_type type,
req.fs.add_header_token(name, value, false, token); req.fs.add_header_token(name, value, false, token);
} }
if (req.fs.index_headers() != 0) { if (req.fs.parse_content_length() != 0) {
if (upstream->error_reply(downstream, 400) != 0) { if (upstream->error_reply(downstream, 400) != 0) {
ULOG(FATAL, upstream) << "error_reply failed"; ULOG(FATAL, upstream) << "error_reply failed";
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment