]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Common source file changes not directly applicable to open-vm-tools.
authorOliver Kurth <okurth@vmware.com>
Tue, 26 May 2020 22:32:56 +0000 (15:32 -0700)
committerOliver Kurth <okurth@vmware.com>
Tue, 26 May 2020 22:32:56 +0000 (15:32 -0700)
open-vm-tools/lib/asyncsocket/asyncSocketInterface.c
open-vm-tools/lib/asyncsocket/asyncSocketVTable.h
open-vm-tools/lib/asyncsocket/asyncsocket.c
open-vm-tools/lib/include/asyncsocket.h

index bcde20cc6b4b00f34082a59c2fd8b17ba46a1c20..db2d7b7384d5b8d63b8ba0fc8211fdffb74e9d89 100644 (file)
@@ -1514,6 +1514,38 @@ AsyncSocket_GetWebSocketProtocol(AsyncSocket *asock)  // IN
 }
 
 
+/*
+ *----------------------------------------------------------------------------
+ *
+ * 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;
+}
+
+
 /*
  *----------------------------------------------------------------------------
  *
index d8294e59a6a6456ab503f01ec0c5f307cbdac597..6c50c2fdfefc82a7ff19738f94e086a4a0085d31 100644 (file)
@@ -120,6 +120,8 @@ typedef struct AsyncSocketVTable {
    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,
index 038a9486ecde5a65d4517be82b0913ee87aea0bf..bc5c9c6eb2ada0dba9fb761e36091414eb9352cc 100644 (file)
@@ -411,6 +411,7 @@ static const AsyncSocketVTable asyncTCPSocketVTable = {
    NULL,                        /* getWebSocketCloseStatus */
    NULL,                        /* getWebSocketProtocol */
    NULL,                        /* setWebSocketCookie */
+   NULL,                        /* setDelayWebSocketUpgradeResponse */
    AsyncTCPSocketRecvBlocking,
    AsyncTCPSocketRecvPartialBlocking,
    AsyncTCPSocketSendBlocking,
index 27ce6c119bbe2b61f4869a6997a13d9d0b724ad2..4fb8724595e6a166b683df9c0ff8cf751db74e73 100644 (file)
@@ -460,16 +460,18 @@ AsyncSocket *AsyncSocket_ListenWebSocket(const char *addrStr,
                                          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,
@@ -723,10 +725,10 @@ char *AsyncSocket_GetWebSocketCookie(AsyncSocket *asock);
 /*
  * 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
@@ -738,6 +740,19 @@ uint16 AsyncSocket_GetWebSocketCloseStatus(AsyncSocket *asock);
  */
 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
  */