diff --git a/websocket/src/handshake.cpp b/websocket/src/handshake.cpp index 88461d0..5d5fdcd 100644 --- a/websocket/src/handshake.cpp +++ b/websocket/src/handshake.cpp @@ -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? diff --git a/websocket/src/websocket.cpp b/websocket/src/websocket.cpp index 1ce2ff3..0e07edf 100644 --- a/websocket/src/websocket.cpp +++ b/websocket/src/websocket.cpp @@ -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]; } diff --git a/websocket/src/websocket.h b/websocket/src/websocket.h index 8adffb2..feceb96 100644 --- a/websocket/src/websocket.h +++ b/websocket/src/websocket.h @@ -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); }