diff --git a/source/common/http/conn_manager_impl.cc b/source/common/http/conn_manager_impl.cc index 30c7fca6ef5a..ac3bd1157891 100644 --- a/source/common/http/conn_manager_impl.cc +++ b/source/common/http/conn_manager_impl.cc @@ -1716,7 +1716,8 @@ void ConnectionManagerImpl::ActiveStream::encodeHeadersInternal(ResponseHeaderMa // If the connection manager is draining send "Connection: Close" on HTTP/1.1 connections. // Do not do this for H2 (which drains via GOAWAY) or Upgrade or CONNECT (as the // payload is no longer HTTP/1.1) - if (!Utility::isUpgrade(headers) && !HeaderUtility::isConnectResponse(request_headers_, *response_headers_)) { + if (!Utility::isUpgrade(headers) && + !HeaderUtility::isConnectResponse(request_headers_, *response_headers_)) { headers.setReferenceConnection(Headers::get().ConnectionValues.Close); } } diff --git a/source/common/http/header_utility.cc b/source/common/http/header_utility.cc index 6aff484c375d..00f089cd10c1 100644 --- a/source/common/http/header_utility.cc +++ b/source/common/http/header_utility.cc @@ -165,7 +165,8 @@ bool HeaderUtility::isConnect(const RequestHeaderMap& headers) { bool HeaderUtility::isConnectResponse(const RequestHeaderMapPtr& request_headers, const ResponseHeaderMap& response_headers) { return request_headers.get() && isConnect(*request_headers) && - Http::Utility::getResponseStatus(response_headers) == 200; + static_cast(Http::Utility::getResponseStatus(response_headers)) == + Http::Code::OK; } void HeaderUtility::addHeaders(HeaderMap& headers, const HeaderMap& headers_to_add) { diff --git a/source/common/http/http1/codec_impl.cc b/source/common/http/http1/codec_impl.cc index a01f109f9611..2ab8d5be3a2d 100644 --- a/source/common/http/http1/codec_impl.cc +++ b/source/common/http/http1/codec_impl.cc @@ -165,7 +165,7 @@ void StreamEncoderImpl::encodeHeadersBase(const RequestOrResponseHeaderMap& head } else if (connection_.protocol() == Protocol::Http10) { chunk_encoding_ = false; } else { - // For responses to connct requests, do not send the chunked encoding header: + // For responses to connect requests, do not send the chunked encoding header: // https://tools.ietf.org/html/rfc7231#section-4.3.6 if (!is_response_to_connect_request_) { encodeFormattedHeader(Headers::get().TransferEncoding.get(), @@ -1055,10 +1055,11 @@ int ClientConnectionImpl::onHeadersComplete() { ENVOY_CONN_LOG(trace, "codec entering upgrade mode for CONNECT response.", connection_); handling_upgrade_ = true; - // For responses to connct requests, do not accept the chunked + // For responses to connect requests, do not accept the chunked // encoding header: https://tools.ietf.org/html/rfc7231#section-4.3.6 if (headers->TransferEncoding() && - absl::EqualsIgnoreCase(headers->TransferEncoding()->value().getStringView(), Headers::get().TransferEncodingValues.Chunked)) { + absl::EqualsIgnoreCase(headers->TransferEncoding()->value().getStringView(), + Headers::get().TransferEncodingValues.Chunked)) { sendProtocolError(Http1ResponseCodeDetails::get().InvalidTransferEncoding); throw CodecProtocolException("http/1.1 protocol error: unsupported transfer encoding"); }