Fix RWI websocket disconnect issue. 42/311942/3
authorjiangyuwei <yuwei.jiang@samsung.com>
Fri, 31 May 2024 02:22:43 +0000 (10:22 +0800)
committerBot Blink <blinkbot@samsung.com>
Fri, 31 May 2024 03:23:44 +0000 (03:23 +0000)
This patch fix RWI websocket disconnect issue temporarily.
Comment these codes to skip |origin| check.

Refer:
  - https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/310919/
  - https://chromium-review.googlesource.com/c/chromium/src/+/4106102

Change-Id: I733e777571fc6255ad3145230511c19110b5db5d
Signed-off-by: jiangyuwei <yuwei.jiang@samsung.com>
content/browser/devtools/devtools_http_handler.cc

index 777245bb9e6513ab0877d348e0e678e95ec517a1..2fe3621344fc864ef1cd87a5fdd9a21347c7df10 100644 (file)
@@ -795,22 +795,26 @@ void DevToolsHttpHandler::OnWebSocketRequest(
   if (!thread_)
     return;
 
-#if BUILDFLAG(IS_TIZEN_TV)
-  if (request.headers.count("origin") &&
-      !remote_allow_origins_.count(request.headers.at("origin")) &&
-      !remote_allow_origins_.count("*")) {
-    const std::string& origin = request.headers.at("origin");
-    const std::string message = base::StringPrintf(
-        "Rejected an incoming WebSocket connection from the %s origin. "
-        "Use the command line flag --remote-allow-origins=%s to allow "
-        "connections from this origin or --remote-allow-origins=* to allow all "
-        "origins.",
-        origin.c_str(), origin.c_str());
-    Send403(connection_id, message);
-    LOG(ERROR) << message;
-    return;
-  }
-#endif
+  // FIXME: This check will refuse RWI web socket connect,
+  // will cause RWI disabled, shows "websocket disconnect".
+  // Comment this check to use RWI temporarily, and analyse
+  // upstream patch later.
+  // Refer: https://chromium-review.googlesource.com/c/chromium/src/+/4106102
+  // #if BUILDFLAG(IS_TIZEN_TV)
+  //   if (request.headers.count("origin") &&
+  //       !remote_allow_origins_.count(request.headers.at("origin")) &&
+  //       !remote_allow_origins_.count("*")) {
+  //     const std::string& origin = request.headers.at("origin");
+  //     const std::string message = base::StringPrintf(
+  //         "Rejected an incoming WebSocket connection from the %s origin. "
+  //         "Use the command line flag --remote-allow-origins=%s to allow "
+  //         "connections from this origin or --remote-allow-origins=* to allow
+  //         all " "origins.", origin.c_str(), origin.c_str());
+  //     Send403(connection_id, message);
+  //     LOG(ERROR) << message;
+  //     return;
+  //   }
+  // #endif
 
   if (base::StartsWith(request.path, browser_guid_,
                        base::CompareCase::SENSITIVE)) {