diff --git a/src/shrpx_http_downstream_connection.cc b/src/shrpx_http_downstream_connection.cc index 3840d12c..144b49f6 100644 --- a/src/shrpx_http_downstream_connection.cc +++ b/src/shrpx_http_downstream_connection.cc @@ -665,7 +665,6 @@ int htp_hdrs_completecb(http_parser *htp) { } } - auto status = resp.http_status; // Ignore the response body. HEAD response may contain // Content-Length or Transfer-Encoding: chunked. Some server send // 304 status code with nonzero Content-Length, but without response @@ -674,10 +673,7 @@ int htp_hdrs_completecb(http_parser *htp) { // TODO It seems that the cases other than HEAD are handled by // http-parser. Need test. - return req.method == HTTP_HEAD || (100 <= status && status <= 199) || - status == 204 || status == 304 - ? 1 - : 0; + return !http2::expect_response_body(req.method, resp.http_status); } } // namespace diff --git a/src/shrpx_worker_process.cc b/src/shrpx_worker_process.cc index 83611aea..fd22bf4b 100644 --- a/src/shrpx_worker_process.cc +++ b/src/shrpx_worker_process.cc @@ -341,13 +341,13 @@ void memcached_get_ticket_key_cb(struct ev_loop *loop, ev_timer *w, key.hmac = EVP_sha256(); key.hmac_keylen = hmac_keylen; - std::copy_n(p, key.data.name.size(), key.data.name.data()); + std::copy_n(p, key.data.name.size(), std::begin(key.data.name)); p += key.data.name.size(); - std::copy_n(p, enc_keylen, key.data.enc_key.data()); + std::copy_n(p, enc_keylen, std::begin(key.data.enc_key)); p += enc_keylen; - std::copy_n(p, hmac_keylen, key.data.hmac_key.data()); + std::copy_n(p, hmac_keylen, std::begin(key.data.hmac_key)); p += hmac_keylen; ticket_keys->keys.push_back(std::move(key));