aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorge E. Moreira <jemoreira@google.com>2021-06-01 16:42:54 -0700
committerRoger Ellis <ellisr@google.com>2021-06-02 22:35:38 +0000
commit89d5bab3441750b567909cf72580aac104e35e8e (patch)
treef459adfb4fadde8e0db6f53a68b15dca0625283d
parent423fc44d5b31c35c91b20af9d262bf69b3637819 (diff)
downloadcuttlefish-89d5bab3441750b567909cf72580aac104e35e8e.tar.gz
Use WSI_TOKEN_HTTP_COLON_PATH as a fallback to get URI path
WSI_TOKEN_GET_URI fails with chrome version 91 and newer. Bug: 189595206 Test: locally Change-Id: Iffbe415a8b9173f7e854c0497021d6d3153bfd68
-rw-r--r--host/libs/websocket/websocket_server.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/host/libs/websocket/websocket_server.cpp b/host/libs/websocket/websocket_server.cpp
index 784db67dd..cdfcba23e 100644
--- a/host/libs/websocket/websocket_server.cpp
+++ b/host/libs/websocket/websocket_server.cpp
@@ -109,6 +109,11 @@ std::string WebSocketServer::GetPath(struct lws* wsi) {
auto len = lws_hdr_total_length(wsi, WSI_TOKEN_GET_URI);
std::string path(len + 1, '\0');
auto ret = lws_hdr_copy(wsi, path.data(), path.size(), WSI_TOKEN_GET_URI);
+ if (ret <= 0) {
+ len = lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_COLON_PATH);
+ path.resize(len + 1, '\0');
+ ret = lws_hdr_copy(wsi, path.data(), path.size(), WSI_TOKEN_HTTP_COLON_PATH);
+ }
if (ret < 0) {
LOG(FATAL) << "Something went wrong getting the path";
}