Skip to content

Instantly share code, notes, and snippets.

@th0br0
Created September 9, 2011 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save th0br0/1206104 to your computer and use it in GitHub Desktop.
Save th0br0/1206104 to your computer and use it in GitHub Desktop.
diff --git a/lib/handshake.c b/lib/handshake.c
index d41414b..0c05839 100644
--- a/lib/handshake.c
+++ b/lib/handshake.c
@@ -699,6 +699,7 @@ libwebsocket_read(struct libwebsocket_context *context, struct libwebsocket *wsi
case 5:
case 6:
case 7:
+ case 8:
wsi->xor_mask = xor_mask_05;
debug("libwebsocket_parse calling handshake_04\n");
if (handshake_0405(context, wsi))
diff --git a/lib/parsers.c b/lib/parsers.c
index 7ad040e..4097f32 100644
--- a/lib/parsers.c
+++ b/lib/parsers.c
@@ -317,6 +317,7 @@ libwebsocket_rx_sm(struct libwebsocket *wsi, unsigned char c)
wsi->lws_rx_parse_state = LWS_RXPS_04_MASK_NONCE_1;
break;
case 7:
+ case 8:
/*
* no prepended frame key any more
*/
@@ -1613,7 +1614,8 @@ int libwebsocket_write(struct libwebsocket *wsi, unsigned char *buf,
buf[len] = 0xff; /* EOT marker */
post = 1;
break;
-
+
+ case 8:
case 7:
if (masked7) {
pre += 4;
diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h
index e706bf5..4de57f7 100644
--- a/lib/private-libwebsockets.h
+++ b/lib/private-libwebsockets.h
@@ -68,6 +68,10 @@
#include "libwebsockets.h"
+#include <R.h>
+#define USE_RINTERNALS
+#include <Rinternals.h>
+
#if 0
#define DEBUG
#endif
@@ -114,7 +118,7 @@ void debug(const char *format, ...)
#define MAX_BROADCAST_PAYLOAD 2048
#define LWS_MAX_PROTOCOLS 10
#define LWS_MAX_EXTENSIONS_ACTIVE 10
-#define SPEC_LATEST_SUPPORTED 7
+#define SPEC_LATEST_SUPPORTED 8
#define MAX_WEBSOCKET_04_KEY_LEN 128
#define SYSTEM_RANDOM_FILEPATH "/dev/urandom"
@@ -245,6 +249,12 @@ struct libwebsocket_context {
struct libwebsocket_protocols *protocols;
int count_protocols;
struct libwebsocket_extension *extensions;
+
+ /* We added this extra pointer to help track a corresponding R environment:
+ * * (R websockets package)
+ * */
+ SEXP renv;
+
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment