private fork
Fork of GSwifiInterface by
Diff: GSwifi/GSwifi_httpd_ws.cpp
- Revision:
- 17:c30ed7b1536d
- Parent:
- 15:086d1a33a197
diff -r 105b56570533 -r c30ed7b1536d GSwifi/GSwifi_httpd_ws.cpp --- a/GSwifi/GSwifi_httpd_ws.cpp Tue Mar 04 15:01:38 2014 +0000 +++ b/GSwifi/GSwifi_httpd_ws.cpp Fri Mar 07 15:16:55 2014 +0000 @@ -39,7 +39,7 @@ DBG("ws cid %d\r\n", cid); // request - snprintf(cmd, sizeof(cmd), "GET %d HTTP/1.1\r\n", uri); + snprintf(cmd, sizeof(cmd), "GET %s HTTP/1.1\r\n", uri); send(cid, cmd, strlen(cmd)); if (host) { snprintf(cmd, sizeof(cmd), "Host: %s\r\n", host); @@ -55,11 +55,13 @@ send(cid, cmd, strlen(cmd)); strcpy(cmd, "Connection: Upgrade\r\n"); send(cid, cmd, strlen(cmd)); - getMacAddress(tmp); - memcpy(&tmp[6], host, 10); - base64encode(tmp, 16, cmd, sizeof(cmd)); + getMacAddress(cmd); + memcpy(&cmd[6], host, 10); + base64encode(cmd, 16, tmp, sizeof(tmp)); snprintf(cmd, sizeof(cmd), "Sec-WebSocket-Key: %s\r\n", tmp); send(cid, cmd, strlen(cmd)); +// strcpy(cmd, "Sec-WebSocket-Protocol: chat\r\n"); +// send(cid, cmd, strlen(cmd)); strcpy(cmd, "Sec-WebSocket-Version: 13\r\n\r\n"); send(cid, cmd, strlen(cmd));