}
+/*
+ *----------------------------------------------------------------------------
+ *
+ * AsyncSocket_SetDelayWebSocketUpgradeResponse --
+ *
+ * Set a flag for whether or not to not automatically send the websocket
+ * upgrade response upon receiving the websocket upgrade request.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------------
+ */
+
+int
+AsyncSocket_SetDelayWebSocketUpgradeResponse(AsyncSocket *asock, // IN
+ Bool delayWebSocketUpgradeResponse) // IN
+{
+ int ret = ASOCKERR_GENERIC;
+ if (VALID(asock, setDelayWebSocketUpgradeResponse)) {
+ AsyncSocketLock(asock);
+ ret = VT(asock)->setDelayWebSocketUpgradeResponse(asock,
+ delayWebSocketUpgradeResponse);
+ AsyncSocketUnlock(asock);
+ }
+ return ret;
+}
+
+
/*
*----------------------------------------------------------------------------
*
const char *(*getWebSocketProtocol)(AsyncSocket *asock);
int (*setWebSocketCookie)(AsyncSocket *asock, void *clientData,
const char *path, const char *sessionId);
+ int (*setDelayWebSocketUpgradeResponse)(AsyncSocket *asock,
+ Bool delayWebSocketUpgradeResponse);
int (*recvBlocking)(AsyncSocket *s, void *buf, int len, int *received,
int timeoutMS);
int (*recvPartialBlocking)(AsyncSocket *s, void *buf, int len,
NULL, /* getWebSocketCloseStatus */
NULL, /* getWebSocketProtocol */
NULL, /* setWebSocketCookie */
+ NULL, /* setDelayWebSocketUpgradeResponse */
AsyncTCPSocketRecvBlocking,
AsyncTCPSocketRecvPartialBlocking,
AsyncTCPSocketSendBlocking,
AsyncSocketPollParams *pollParams,
void *sslCtx,
int *outError);
-AsyncSocket *AsyncSocket_ListenWebSocketEx(const char *addrStr,
- unsigned int port,
- Bool useSSL,
- const char *protocols[],
- AsyncSocketConnectFn connectFn,
- void *clientData,
- AsyncSocketPollParams *pollParams,
- void *sslCtx,
- AsyncWebSocketHandleUpgradeRequestFn handleUpgradeRequestFn,
- int *outError);
+AsyncSocket *AsyncSocket_PrepareListenWebSocket(Bool useSSL,
+ const char *protocols[],
+ AsyncSocketConnectFn connectFn,
+ void *clientData,
+ AsyncSocketPollParams *pollParams,
+ void *sslCtx,
+ AsyncWebSocketHandleUpgradeRequestFn handleUpgradeRequestFn);
+AsyncSocket *AsyncSocket_RegisterListenWebSocket(AsyncSocket *asock,
+ const char *addrStr,
+ unsigned int port,
+ AsyncSocketPollParams *pollParams,
+ int *outError);
#ifndef _WIN32
AsyncSocket *AsyncSocket_ListenWebSocketUDS(const char *pipeName,
/*
* Set the Cookie for a websocket connection
*/
-int AsyncSocket_SetWebSocketCookie(AsyncSocket *asock, // IN
- void *clientData, // IN
- const char *path, // IN
- const char *sessionId); // IN
+int AsyncSocket_SetWebSocketCookie(AsyncSocket *asock,
+ void *clientData,
+ const char *path,
+ const char *sessionId);
/*
* Retrieve the close status, if received, for a websocket connection
*/
const char *AsyncSocket_GetWebSocketProtocol(AsyncSocket *asock);
+/*
+ * Set the flag for whether or not to delay websocket upgrade response
+ */
+int AsyncSocket_SetDelayWebSocketUpgradeResponse(AsyncSocket *asock,
+ Bool delayWebSocketUpgradeResponse);
+
+/*
+ * Send the websocket upgrade response
+ */
+void
+AsyncSocket_WebSocketServerSendUpgradeResponse(AsyncSocket *base,
+ char *httpResponseTemp);
+
/*
* Get error code for websocket failure
*/