diff --git a/src/shrpx_downstream.cc b/src/shrpx_downstream.cc index 11ec9756..9cfc2cc7 100644 --- a/src/shrpx_downstream.cc +++ b/src/shrpx_downstream.cc @@ -367,7 +367,7 @@ void append_last_header_value(bool &key_prev, size_t &sum, Headers &headers, } } // namespace -int FieldStore::index_headers() { +int FieldStore::parse_content_length() { content_length = -1; for (auto &kv : headers_) { diff --git a/src/shrpx_downstream.h b/src/shrpx_downstream.h index 8a855b1c..4306940d 100644 --- a/src/shrpx_downstream.h +++ b/src/shrpx_downstream.h @@ -89,10 +89,9 @@ public: bool header_key_prev() const { return header_key_prev_; } - // Lower the header field names and indexes header fields. If there - // is any invalid headers (e.g., multiple Content-Length having - // different values), returns -1. - int index_headers(); + // Parses content-length, and records it in the field. If there are + // multiple Content-Length, returns -1. + int parse_content_length(); // Empties headers. void clear_headers(); diff --git a/src/shrpx_http_downstream_connection.cc b/src/shrpx_http_downstream_connection.cc index c5b3da09..9e55f39b 100644 --- a/src/shrpx_http_downstream_connection.cc +++ b/src/shrpx_http_downstream_connection.cc @@ -572,7 +572,7 @@ int htp_hdrs_completecb(http_parser *htp) { resp.http_major = htp->http_major; 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); return -1; } diff --git a/src/shrpx_https_upstream.cc b/src/shrpx_https_upstream.cc index c84af459..9eaa5202 100644 --- a/src/shrpx_https_upstream.cc +++ b/src/shrpx_https_upstream.cc @@ -270,7 +270,7 @@ int htp_hdrs_completecb(http_parser *htp) { ULOG(INFO, upstream) << "HTTP request headers\n" << ss.str(); } - if (req.fs.index_headers() != 0) { + if (req.fs.parse_content_length() != 0) { return -1; } diff --git a/src/shrpx_spdy_upstream.cc b/src/shrpx_spdy_upstream.cc index dc4a5db1..d9c22209 100644 --- a/src/shrpx_spdy_upstream.cc +++ b/src/shrpx_spdy_upstream.cc @@ -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); } - if (req.fs.index_headers() != 0) { + if (req.fs.parse_content_length() != 0) { if (upstream->error_reply(downstream, 400) != 0) { ULOG(FATAL, upstream) << "error_reply failed"; }