Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/ts/apidefs.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ typedef enum {
TS_HTTP_STATUS_PRECONDITION_REQUIRED = 428,
TS_HTTP_STATUS_TOO_MANY_REQUESTS = 429,
TS_HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
TS_HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS = 451,
TS_HTTP_STATUS_INTERNAL_SERVER_ERROR = 500,
TS_HTTP_STATUS_NOT_IMPLEMENTED = 501,
TS_HTTP_STATUS_BAD_GATEWAY = 502,
Expand Down
1 change: 1 addition & 0 deletions include/tscpp/api/HttpStatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ enum HttpStatus {
HTTP_STATUS_PRECONDITION_REQUIRED = 428,
HTTP_STATUS_TOO_MANY_REQUESTS = 429,
HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS = 451,

HTTP_STATUS_INTERNAL_SERVER_ERROR = 500,
HTTP_STATUS_NOT_IMPLEMENTED = 501,
Expand Down
2 changes: 1 addition & 1 deletion iocore/net/I_NetVConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ class NetVConnection : public VConnection, public PluginUserArgs<TS_USER_ARGS_VC
return pp_info.proxy_protocol_version;
}

sockaddr const *get_proxy_protocol_addr(const ProxyProtocolData);
sockaddr const *get_proxy_protocol_addr(const ProxyProtocolData) const;

sockaddr const *
get_proxy_protocol_src_addr()
Expand Down
20 changes: 7 additions & 13 deletions iocore/net/P_NetVConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,14 @@ NetVConnection::get_local_port()
}

inline sockaddr const *
NetVConnection::get_proxy_protocol_addr(const ProxyProtocolData src_or_dst)
NetVConnection::get_proxy_protocol_addr(const ProxyProtocolData src_or_dst) const
{
if (src_or_dst == ProxyProtocolData::SRC) {
if ((pp_info.src_addr.isValid() && pp_info.src_addr.port() != 0) ||
(ats_is_ip4(&pp_info.src_addr) && INADDR_ANY != ats_ip4_addr_cast(&pp_info.src_addr)) // IPv4
|| (ats_is_ip6(&pp_info.src_addr) && !IN6_IS_ADDR_UNSPECIFIED(&pp_info.src_addr.sin6.sin6_addr))) {
return &pp_info.src_addr.sa;
}
} else {
if ((pp_info.dst_addr.isValid() && pp_info.dst_addr.port() != 0) ||
(ats_is_ip4(&pp_info.dst_addr) && INADDR_ANY != ats_ip4_addr_cast(&pp_info.dst_addr)) // IPv4
|| (ats_is_ip6(&pp_info.dst_addr) && !IN6_IS_ADDR_UNSPECIFIED(&pp_info.dst_addr.sin6.sin6_addr))) {
return &pp_info.dst_addr.sa;
}
const IpEndpoint &addr = (src_or_dst == ProxyProtocolData::SRC ? pp_info.src_addr : pp_info.dst_addr);

if ((addr.isValid() && addr.port() != 0) || (ats_is_ip4(&addr) && INADDR_ANY != ats_ip4_addr_cast(&addr)) // IPv4
|| (ats_is_ip6(&addr) && !IN6_IS_ADDR_UNSPECIFIED(&addr.sin6.sin6_addr))) {
return &addr.sa;
}

return nullptr;
}
6 changes: 2 additions & 4 deletions proxy/http/HttpTransact.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5714,8 +5714,6 @@ HttpTransact::initialize_state_variables_from_request(State *s, HTTPHdr *obsolet
HTTP_INCREMENT_DYN_STAT(http_push_requests_stat);
} else if (s->method == HTTP_WKSIDX_OPTIONS) {
HTTP_INCREMENT_DYN_STAT(http_options_requests_stat);
} else if (s->method == HTTP_WKSIDX_TRACE) {
HTTP_INCREMENT_DYN_STAT(http_trace_requests_stat);
} else {
HTTP_INCREMENT_DYN_STAT(http_extension_method_requests_stat);
SET_VIA_STRING(VIA_DETAIL_TUNNEL, VIA_DETAIL_TUNNEL_METHOD);
Expand Down Expand Up @@ -6844,7 +6842,7 @@ HttpTransact::handle_request_keep_alive_headers(State *s, HTTPVersion ver, HTTPH
case KA_CONNECTION:
ink_assert(s->current.server->keep_alive != HTTP_NO_KEEPALIVE);
if (ver == HTTPVersion(1, 0)) {
if (s->current.request_to == PARENT_PROXY) {
if (s->current.request_to == PARENT_PROXY && s->parent_result.parent_is_proxy()) {
heads->value_set(MIME_FIELD_PROXY_CONNECTION, MIME_LEN_PROXY_CONNECTION, "keep-alive", 10);
} else {
heads->value_set(MIME_FIELD_CONNECTION, MIME_LEN_CONNECTION, "keep-alive", 10);
Expand All @@ -6858,7 +6856,7 @@ HttpTransact::handle_request_keep_alive_headers(State *s, HTTPVersion ver, HTTPH
if (s->current.server->keep_alive != HTTP_NO_KEEPALIVE || (ver == HTTPVersion(1, 1))) {
/* Had keep-alive */
s->current.server->keep_alive = HTTP_NO_KEEPALIVE;
if (s->current.request_to == PARENT_PROXY) {
if (s->current.request_to == PARENT_PROXY && s->parent_result.parent_is_proxy()) {
heads->value_set(MIME_FIELD_PROXY_CONNECTION, MIME_LEN_PROXY_CONNECTION, "close", 5);
} else {
heads->value_set(MIME_FIELD_CONNECTION, MIME_LEN_CONNECTION, "close", 5);
Expand Down
4 changes: 3 additions & 1 deletion proxy/http2/HPACK.cc
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,9 @@ decode_literal_header_field(MIMEFieldWrapper &header, const uint8_t *buf_start,

// Decode header field name
if (index) {
indexing_table.get_header_field(index, header);
if (indexing_table.get_header_field(index, header) == HPACK_ERROR_COMPRESSION_ERROR) {
return HPACK_ERROR_COMPRESSION_ERROR;
}
} else {
char *name_str = nullptr;
uint64_t name_str_len = 0;
Expand Down