Skip to content
Merged

Fixes #7971

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
2 changes: 1 addition & 1 deletion plugins/cachekey/cachekey.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ appendEncoded(String &target, const char *s, size_t len)
return;
}

char tmp[len * 2];
char tmp[len * 3 + 1];
size_t written;

/* The default table does not encode the comma, so we need to use our own table here. */
Expand Down
11 changes: 11 additions & 0 deletions proxy/hdrs/HTTP.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,17 @@ validate_hdr_content_length(HdrHeap *heap, HTTPHdrImpl *hh)
int content_length_len = 0;
const char *content_length_val = content_length_field->value_get(&content_length_len);

// RFC 7230 section 3.3.2
// Content-Length = 1*DIGIT
//
// If the content-length value contains a non-numeric value, the header is invalid
for (int i = 0; i < content_length_len; i++) {
if (!isdigit(content_length_val[i])) {
Debug("http", "Content-Length value contains non-digit, returning parse error");
return PARSE_RESULT_ERROR;
}
}

while (content_length_field->has_dups()) {
int content_length_len_2 = 0;
const char *content_length_val_2 = content_length_field->m_next_dup->value_get(&content_length_len_2);
Expand Down
5 changes: 4 additions & 1 deletion proxy/http/HttpTransact.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7619,9 +7619,12 @@ HttpTransact::build_request(State *s, HTTPHdr *base_request, HTTPHdr *outgoing_r

// HttpTransactHeaders::convert_request(outgoing_version, outgoing_request); // commented out this idea

URL *url = outgoing_request->url_get();
// Remove fragment from upstream URL
url->fragment_set(NULL, 0);

// Check whether a Host header field is missing from a 1.0 or 1.1 request.
if (outgoing_version != HTTPVersion(0, 9) && !outgoing_request->presence(MIME_PRESENCE_HOST)) {
URL *url = outgoing_request->url_get();
int host_len;
const char *host = url->host_get(&host_len);

Expand Down
14 changes: 7 additions & 7 deletions proxy/http2/Http2ClientSession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ Http2ClientSession::destroy()
void
Http2ClientSession::free()
{
if (this->_reenable_event) {
this->_reenable_event->cancel();
this->_reenable_event = nullptr;
}

if (h2_pushed_urls) {
this->h2_pushed_urls = ink_hash_table_destroy(this->h2_pushed_urls);
}
Expand All @@ -107,6 +102,11 @@ Http2ClientSession::free()
REMEMBER(NO_EVENT, this->recursion)
Http2SsnDebug("session free");

if (this->_reenable_event) {
this->_reenable_event->cancel();
this->_reenable_event = nullptr;
}

// Don't free active ProxySession
ink_release_assert(is_active() == false);

Expand Down Expand Up @@ -653,8 +653,8 @@ Http2ClientSession::remember(const SourceLocation &location, int event, int reen
bool
Http2ClientSession::_should_do_something_else()
{
// Do something else every 128 incoming frames
return (this->_n_frame_read & 0x7F) == 0;
// Do something else every 128 incoming frames if connection state isn't closed
return (this->_n_frame_read & 0x7F) == 0 && !connection_state.is_state_closed();
}

int64_t
Expand Down
2 changes: 1 addition & 1 deletion proxy/logging/LogUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ escapify_url_common(Arena *arena, char *url, size_t len_in, int *len_out, char *
//
size_t out_len = len_in + 2 * count;

if (dst && out_len > dst_size) {
if (dst && (out_len + 1) > dst_size) {
*len_out = 0;
return nullptr;
}
Expand Down