You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2020/03/19 20:52:08 UTC
[trafficserver] branch 8.1.x updated: Move websocket upgrade later
in state machine
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 8.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/8.1.x by this push:
new ac2f0fd Move websocket upgrade later in state machine
ac2f0fd is described below
commit ac2f0fdaedefb36a3e5922429251d5dc66ce4362
Author: Randall Meyer <rr...@apache.org>
AuthorDate: Thu Oct 31 12:31:26 2019 -0700
Move websocket upgrade later in state machine
This allows for hooks to be applied to ws requests
(cherry picked from commit f7afea3d6e2a41ccaf6b866bd5d29e5075b84497)
---
proxy/http/HttpTransact.cc | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 2bab304..0534036 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -647,6 +647,14 @@ HttpTransact::StartRemapRequest(State *s)
}
TxnDebug("http_trans", "END HttpTransact::StartRemapRequest");
+
+ TxnDebug("http_trans", "Checking if transaction wants to upgrade");
+ if (handle_upgrade_request(s)) {
+ // everything should be handled by the upgrade handler.
+ TxnDebug("http_trans", "Transaction will be upgraded by the appropriate upgrade handler.");
+ return;
+ }
+
TRANSACT_RETURN(SM_ACTION_API_PRE_REMAP, HttpTransact::PerformRemap);
}
@@ -838,6 +846,9 @@ done:
bool
HttpTransact::handle_upgrade_request(State *s)
{
+ HTTPHdr &request = s->hdr_info.client_request;
+ s->method = request.method_get_wksidx();
+
// Quickest way to determine that this is defintely not an upgrade.
/* RFC 6455 The method of the request MUST be GET, and the HTTP version MUST
be at least 1.1. */
@@ -950,7 +961,7 @@ HttpTransact::handle_websocket_upgrade_pre_remap(State *s)
TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, nullptr);
}
- TRANSACT_RETURN(SM_ACTION_API_READ_REQUEST_HDR, HttpTransact::StartRemapRequest);
+ TRANSACT_RETURN(SM_ACTION_API_PRE_REMAP, HttpTransact::PerformRemap);
}
void
@@ -995,7 +1006,7 @@ HttpTransact::ModifyRequest(State *s)
bootstrap_state_variables_from_request(s, &request);
////////////////////////////////////////////////
- // If there is no scheme default to http //
+ // If there is no scheme, default to http //
////////////////////////////////////////////////
URL *url = request.url_get();
@@ -1064,13 +1075,6 @@ HttpTransact::ModifyRequest(State *s)
}
TxnDebug("http_trans", "END HttpTransact::ModifyRequest");
- TxnDebug("http_trans", "Checking if transaction wants to upgrade");
-
- if (handle_upgrade_request(s)) {
- // everything should be handled by the upgrade handler.
- TxnDebug("http_trans", "Transaction will be upgraded by the appropriate upgrade handler.");
- return;
- }
TRANSACT_RETURN(SM_ACTION_API_READ_REQUEST_HDR, HttpTransact::StartRemapRequest);
}