mirror of
https://github.com/defold/extension-websocket.git
synced 2025-09-30 09:12:18 +02:00
Handshake response object if handshake failed (#29)
* added handshake response object, so if error occurs on websocket handhsake stage, server's response can be reachable for further decisions * fixed typo; removed c++11 style constructors
This commit is contained in:
committed by
GitHub
parent
39abd7cdea
commit
ac230a6278
@@ -78,6 +78,27 @@ namespace dmWebsocket
|
||||
uint32_t m_Type:2;
|
||||
};
|
||||
|
||||
struct HttpHeader
|
||||
{
|
||||
const char* m_Key;
|
||||
const char* m_Value;
|
||||
HttpHeader(const char* key, const char* value);
|
||||
~HttpHeader();
|
||||
};
|
||||
|
||||
struct HandshakeResponse
|
||||
{
|
||||
int m_HttpMajor;
|
||||
int m_HttpMinor;
|
||||
int m_ResponseStatusCode;
|
||||
int m_BodyOffset;
|
||||
dmArray<HttpHeader*> m_Headers;
|
||||
|
||||
~HandshakeResponse();
|
||||
HttpHeader* GetHeader(const char* header);
|
||||
};
|
||||
|
||||
|
||||
struct WebsocketConnection
|
||||
{
|
||||
dmScript::LuaCallbackInfo* m_Callback;
|
||||
@@ -101,6 +122,7 @@ namespace dmWebsocket
|
||||
uint8_t m_SSL:1;
|
||||
uint8_t m_HasHandshakeData:1;
|
||||
uint8_t :7;
|
||||
HandshakeResponse* m_HandshakeResponse;
|
||||
};
|
||||
|
||||
// Set error message
|
||||
@@ -148,16 +170,6 @@ namespace dmWebsocket
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user