summaryrefslogtreecommitdiff
path: root/chat/jabberd2/patches
diff options
context:
space:
mode:
authordbj <dbj@pkgsrc.org>2021-02-06 15:20:15 +0000
committerdbj <dbj@pkgsrc.org>2021-02-06 15:20:15 +0000
commit16e422d1f4fe113aaf70bf2de76ad5caf1933c98 (patch)
tree0b940fc35d99f3943b65e6d66b2d1e67cb0daf65 /chat/jabberd2/patches
parent2955dc24349f002bb7507ebc5523f91bf5350cb2 (diff)
downloadpkgsrc-16e422d1f4fe113aaf70bf2de76ad5caf1933c98.tar.gz
chat/jabberd2: use htons instead of non-portable htobe16
Diffstat (limited to 'chat/jabberd2/patches')
-rw-r--r--chat/jabberd2/patches/patch-sx_websocket.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/chat/jabberd2/patches/patch-sx_websocket.c b/chat/jabberd2/patches/patch-sx_websocket.c
new file mode 100644
index 00000000000..b4f5d95b8e4
--- /dev/null
+++ b/chat/jabberd2/patches/patch-sx_websocket.c
@@ -0,0 +1,24 @@
+$NetBSD: patch-sx_websocket.c,v 1.1 2021/02/06 15:20:15 dbj Exp $
+
+use htons instead of non-portable htobe16
+
+--- sx/websocket.c.orig 2018-04-22 09:41:35.000000000 +0000
++++ sx/websocket.c
+@@ -214,7 +214,7 @@ int libwebsock_close_with_reason(sx_t s,
+ unsigned short code_be;
+ char buf[128]; //w3 spec on WebSockets API (http://dev.w3.org/html5/websockets/) says reason shouldn't be over 123 bytes. I concur.
+ len = 2;
+- code_be = htobe16(code);
++ code_be = htons(code);
+ memcpy(buf, &code_be, 2);
+ if (reason) {
+ len += snprintf(buf + 2, 124, "%s", reason);
+@@ -235,7 +235,7 @@ int libwebsock_close(sx_t s, _sx_websock
+ void libwebsock_fail_connection(sx_t s, _sx_websocket_conn_t sc, unsigned short close_code) {
+ char close_frame[4] = { 0x88, 0x02, 0x00, 0x00 };
+ unsigned short *code_be = (unsigned short *) &close_frame[2];
+- *code_be = htobe16(WS_CLOSE_PROTOCOL_ERROR);
++ *code_be = htons(WS_CLOSE_PROTOCOL_ERROR);
+
+ sx_buf_t buf = _sx_buffer_new(NULL, sizeof(close_frame), NULL, NULL);
+ memcpy(buf->data, close_frame, buf->len);