Skip to content
Merged
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
5 changes: 0 additions & 5 deletions proxy/ProxyTransaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,6 @@ ProxyTransaction::set_outbound_transparent(bool flag)
upstream_outbound_options.f_outbound_transparent = flag;
}

void
ProxyTransaction::set_h2c_upgrade_flag()
{
}

int
ProxyTransaction::get_transaction_priority_weight() const
{
Expand Down
1 change: 0 additions & 1 deletion proxy/ProxyTransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class ProxyTransaction : public VConnection
virtual bool is_chunked_encoding_supported() const;

virtual void set_proxy_ssn(ProxySession *set_proxy_ssn);
virtual void set_h2c_upgrade_flag();

/// Non-Virtual Methods
//
Expand Down
7 changes: 5 additions & 2 deletions proxy/http/HttpTransact.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1230,9 +1230,12 @@ HttpTransact::handle_upgrade_request(State *s)
} else {
TxnDebug("http_trans_upgrade", "Unable to upgrade connection to websockets, invalid headers (RFC 6455).");
}
} else if (s->upgrade_token_wks == MIME_VALUE_H2C) {
// We need to recognize h2c to not handle it as an error.
// We just ignore the Upgrade header and respond to the request as though the Upgrade header field were absent.
s->is_upgrade_request = false;
return false;
}

// TODO accept h2c token to start HTTP/2 session after TS-3498 is fixed
} else {
TxnDebug("http_trans_upgrade", "Transaction requested upgrade for unknown protocol: %s", upgrade_hdr_val);
}
Expand Down
39 changes: 0 additions & 39 deletions proxy/http2/Http2ClientSession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,45 +226,6 @@ Http2ClientSession::new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOB
do_api_callout(TS_HTTP_SSN_START_HOOK);
}

void
Http2ClientSession::set_upgrade_context(HTTPHdr *h)
{
upgrade_context.req_header = new HTTPHdr();
upgrade_context.req_header->copy(h);

MIMEField *settings = upgrade_context.req_header->field_find(MIME_FIELD_HTTP2_SETTINGS, MIME_LEN_HTTP2_SETTINGS);
ink_release_assert(settings != nullptr);
int svlen;
const char *sv = settings->value_get(&svlen);

if (sv && svlen > 0) {
// Maybe size of data decoded by Base64URL is lower than size of encoded data.
unsigned char out_buf[svlen];
size_t decoded_len;
ats_base64_decode(sv, svlen, out_buf, svlen, &decoded_len);
for (size_t nbytes = 0; nbytes < decoded_len; nbytes += HTTP2_SETTINGS_PARAMETER_LEN) {
Http2SettingsParameter param;
if (!http2_parse_settings_parameter(make_iovec(out_buf + nbytes, HTTP2_SETTINGS_PARAMETER_LEN), param) ||
!http2_settings_parameter_is_valid(param)) {
// TODO ignore incoming invalid parameters and send suitable SETTINGS
// frame.
}
upgrade_context.client_settings.set(static_cast<Http2SettingsIdentifier>(param.id), param.value);
}
}

// Such intermediaries SHOULD also remove other connection-
// specific header fields, such as Keep-Alive, Proxy-Connection,
// Transfer-Encoding and Upgrade, even if they are not nominated by
// Connection.
upgrade_context.req_header->field_delete(MIME_FIELD_CONNECTION, MIME_LEN_CONNECTION);
upgrade_context.req_header->field_delete(MIME_FIELD_KEEP_ALIVE, MIME_LEN_KEEP_ALIVE);
upgrade_context.req_header->field_delete(MIME_FIELD_PROXY_CONNECTION, MIME_LEN_PROXY_CONNECTION);
upgrade_context.req_header->field_delete(MIME_FIELD_TRANSFER_ENCODING, MIME_LEN_TRANSFER_ENCODING);
upgrade_context.req_header->field_delete(MIME_FIELD_UPGRADE, MIME_LEN_UPGRADE);
upgrade_context.req_header->field_delete(MIME_FIELD_HTTP2_SETTINGS, MIME_LEN_HTTP2_SETTINGS);
}

// XXX Currently, we don't have a half-closed state, but we will need to
// implement that. After we send a GOAWAY, there
// are scenarios where we would like to complete the outstanding streams.
Expand Down
28 changes: 0 additions & 28 deletions proxy/http2/Http2ClientSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,6 @@ enum class Http2SsnMilestone {

size_t const HTTP2_HEADER_BUFFER_SIZE_INDEX = CLIENT_CONNECTION_FIRST_READ_BUFFER_SIZE_INDEX;

// To support Upgrade: h2c
struct Http2UpgradeContext {
Http2UpgradeContext() {}
~Http2UpgradeContext()
{
if (req_header) {
req_header->clear();
delete req_header;
}
}

// Modified request header
HTTPHdr *req_header = nullptr;

// Decoded HTTP2-Settings Header Field
Http2ConnectionSettings client_settings;
};

class Http2ClientSession : public ProxySession
{
public:
Expand Down Expand Up @@ -115,7 +97,6 @@ class Http2ClientSession : public ProxySession
void decrement_current_active_client_connections_stat() override;

void set_upgrade_context(HTTPHdr *h);
const Http2UpgradeContext &get_upgrade_context() const;
void set_dying_event(int event);
int get_dying_event() const;
bool ready_to_free() const;
Expand Down Expand Up @@ -168,9 +149,6 @@ class Http2ClientSession : public ProxySession
History<HISTORY_DEFAULT_SIZE> _history;
Milestones<Http2SsnMilestone, static_cast<size_t>(Http2SsnMilestone::LAST_ENTRY)> _milestones;

// For Upgrade: h2c
Http2UpgradeContext upgrade_context;

VIO *write_vio = nullptr;
int dying_event = 0;
bool kill_me = false;
Expand All @@ -192,12 +170,6 @@ extern ClassAllocator<Http2ClientSession> http2ClientSessionAllocator;
///////////////////////////////////////////////
// INLINE

inline const Http2UpgradeContext &
Http2ClientSession::get_upgrade_context() const
{
return upgrade_context;
}

inline bool
Http2ClientSession::ready_to_free() const
{
Expand Down