"%s\r\n",
b64,
proto_buf);
-
+ respond[511] = 0;
ws_raw_write(wsh, respond, strlen(respond));
wsh->handshake = 1;
snprintf(respond, sizeof(respond), "HTTP/1.1 400 Bad Request\r\n"
"Sec-WebSocket-Version: 13\r\n\r\n");
+ respond[511] = 0;
ws_raw_write(wsh, respond, strlen(respond));
ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes)
{
- size_t r;
+ ssize_t r;
int sanity = 2000;
int ssl_err = 0;
restore_socket(wsh->sock);
if (wsh->close_sock && wsh->sock != ws_sock_invalid) {
+#ifndef WIN32
close(wsh->sock);
+#else
+ closesocket(wsh->sock);
+#endif
}
wsh->sock = ws_sock_invalid;
#include <arpa/inet.h>
#include <sys/wait.h>
#include <sys/socket.h>
+#include <unistd.h>
#else
#pragma warning(disable:4996)
#endif
#include <string.h>
-#include <unistd.h>
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include <openssl/ssl.h>
#ifdef _MSC_VER
+#ifndef strncasecmp
#define strncasecmp _strnicmp
+#endif
#define snprintf _snprintf
#ifdef _WIN64
#define WS_SSIZE_T __int64
extern struct ws_globals_s ws_globals;
+#ifndef WIN32
typedef int ws_socket_t;
-#define ws_sock_invalid -1
+#else
+typedef SOCKET ws_socket_t;
+#endif
+#define ws_sock_invalid (ws_socket_t)-1
typedef enum {