mirror of
https://github.com/defold/extension-websocket.git
synced 2025-06-27 01:47:42 +02:00
replace dmStriCmp with dmStrCaseCmp (#31)
This commit is contained in:
parent
165b7333dc
commit
7346f142fa
@ -260,8 +260,8 @@ Result VerifyHeaders(WebsocketConnection* conn)
|
||||
connection_header = response->GetHeader("Connection");
|
||||
upgrade_header = response->GetHeader("Upgrade");
|
||||
websocket_secret_header = response->GetHeader("Sec-WebSocket-Accept");
|
||||
bool connection = connection_header && dmStriCmp(connection_header->m_Value, "Upgrade") == 0;
|
||||
bool upgrade = upgrade_header && dmStriCmp(upgrade_header->m_Value, "websocket") == 0;
|
||||
bool connection = connection_header && dmStrCaseCmp(connection_header->m_Value, "Upgrade") == 0;
|
||||
bool upgrade = upgrade_header && dmStrCaseCmp(upgrade_header->m_Value, "websocket") == 0;
|
||||
bool valid_key = websocket_secret_header && ValidateSecretKey(conn, websocket_secret_header->m_Value);
|
||||
|
||||
// Send error to lua?
|
||||
|
@ -64,19 +64,6 @@ const char* StateToString(State err)
|
||||
|
||||
#undef STRING_CASE
|
||||
|
||||
int dmStriCmp(const char* s1, const char* s2)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
if (!*s1 || !*s2 || tolower((unsigned char) *s1) != tolower((unsigned char) *s2))
|
||||
{
|
||||
return (unsigned char) *s1 - (unsigned char) *s2;
|
||||
}
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
}
|
||||
|
||||
void DebugLog(int level, const char* fmt, ...)
|
||||
{
|
||||
if (level > g_DebugWebSocket)
|
||||
@ -444,7 +431,7 @@ HttpHeader* HandshakeResponse::GetHeader(const char* header_key)
|
||||
{
|
||||
for(uint32_t i = 0; i < m_Headers.Size(); ++i)
|
||||
{
|
||||
if (dmStriCmp(m_Headers[i]->m_Key, header_key) == 0)
|
||||
if (dmStrCaseCmp(m_Headers[i]->m_Key, header_key) == 0)
|
||||
{
|
||||
return m_Headers[i];
|
||||
}
|
||||
|
@ -169,7 +169,5 @@ namespace dmWebsocket
|
||||
#else
|
||||
void DebugLog(int level, const char* fmt, ...);
|
||||
#endif
|
||||
|
||||
int dmStriCmp(const char* s1, const char* s2);
|
||||
void DebugPrint(int level, const char* msg, const void* _bytes, uint32_t num_bytes);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user