summaryrefslogtreecommitdiff
path: root/modules/websocket
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-08-09 19:28:08 +0200
committerOmar Polo <op@omarpolo.com>2022-01-20 20:29:15 +0100
commitbd448e5535686a4473d185f4103b4ac4dedf0c71 (patch)
treefe134301a348be44b11d2230fa24a7ca378c43aa /modules/websocket
parent8fc0dd9997c80059ec2b273e7004daa458d370ee (diff)
Rename or refactor macros to avoid leading underscores
These are not used consistently and some can conflict with system-specific defines. While here, also delete some unused macros.
Diffstat (limited to 'modules/websocket')
-rw-r--r--modules/websocket/wsl_client.cpp14
-rw-r--r--modules/websocket/wsl_server.cpp16
2 files changed, 15 insertions, 15 deletions
diff --git a/modules/websocket/wsl_client.cpp b/modules/websocket/wsl_client.cpp
index bccbf88417..be1c75c354 100644
--- a/modules/websocket/wsl_client.cpp
+++ b/modules/websocket/wsl_client.cpp
@@ -124,17 +124,17 @@ bool WSLClient::_verify_headers(String &r_protocol) {
}
}
-#define _WSL_CHECK(NAME, VALUE) \
+#define WSL_CHECK(NAME, VALUE) \
ERR_FAIL_COND_V_MSG(!headers.has(NAME) || headers[NAME].to_lower() != VALUE, false, \
"Missing or invalid header '" + String(NAME) + "'. Expected value '" + VALUE + "'.");
-#define _WSL_CHECK_NC(NAME, VALUE) \
+#define WSL_CHECK_NC(NAME, VALUE) \
ERR_FAIL_COND_V_MSG(!headers.has(NAME) || headers[NAME] != VALUE, false, \
"Missing or invalid header '" + String(NAME) + "'. Expected value '" + VALUE + "'.");
- _WSL_CHECK("connection", "upgrade");
- _WSL_CHECK("upgrade", "websocket");
- _WSL_CHECK_NC("sec-websocket-accept", WSLPeer::compute_key_response(_key));
-#undef _WSL_CHECK_NC
-#undef _WSL_CHECK
+ WSL_CHECK("connection", "upgrade");
+ WSL_CHECK("upgrade", "websocket");
+ WSL_CHECK_NC("sec-websocket-accept", WSLPeer::compute_key_response(_key));
+#undef WSL_CHECK_NC
+#undef WSL_CHECK
if (_protocols.size() == 0) {
// We didn't request a custom protocol
ERR_FAIL_COND_V(headers.has("sec-websocket-protocol"), false);
diff --git a/modules/websocket/wsl_server.cpp b/modules/websocket/wsl_server.cpp
index 31175c5779..eadd7ef7ac 100644
--- a/modules/websocket/wsl_server.cpp
+++ b/modules/websocket/wsl_server.cpp
@@ -58,17 +58,17 @@ bool WSLServer::PendingPeer::_parse_request(const Vector<String> p_protocols, St
headers[name] = value;
}
}
-#define _WSL_CHECK(NAME, VALUE) \
+#define WSL_CHECK(NAME, VALUE) \
ERR_FAIL_COND_V_MSG(!headers.has(NAME) || headers[NAME].to_lower() != VALUE, false, \
"Missing or invalid header '" + String(NAME) + "'. Expected value '" + VALUE + "'.");
-#define _WSL_CHECK_EX(NAME) \
+#define WSL_CHECK_EX(NAME) \
ERR_FAIL_COND_V_MSG(!headers.has(NAME), false, "Missing header '" + String(NAME) + "'.");
- _WSL_CHECK("upgrade", "websocket");
- _WSL_CHECK("sec-websocket-version", "13");
- _WSL_CHECK_EX("sec-websocket-key");
- _WSL_CHECK_EX("connection");
-#undef _WSL_CHECK_EX
-#undef _WSL_CHECK
+ WSL_CHECK("upgrade", "websocket");
+ WSL_CHECK("sec-websocket-version", "13");
+ WSL_CHECK_EX("sec-websocket-key");
+ WSL_CHECK_EX("connection");
+#undef WSL_CHECK_EX
+#undef WSL_CHECK
key = headers["sec-websocket-key"];
if (headers.has("sec-websocket-protocol")) {
Vector<String> protos = headers["sec-websocket-protocol"].split(",");