nghttpx: Rename index_headers() as parse_content_length()

This commit is contained in:
Tatsuhiro Tsujikawa 2016-02-20 21:44:08 +09:00
parent 23ecfd412d
commit 9678daa46a
5 changed files with 7 additions and 8 deletions

View File

@ -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_) {

View File

@ -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();

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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";
}