4 Commits
0.1.0 ... 0.1.3

4 changed files with 21 additions and 8 deletions

View File

@@ -5,6 +5,6 @@
(license "BSD")
(category web)
(author "Thomas Hintz")
(depends spiffy intarweb uri-common base64 simple-sha1 mailbox comparse)
(depends (spiffy 5.3.1) intarweb uri-common base64 simple-sha1 mailbox comparse)
(files "websockets.setup" "websockets.meta" "websockets.release-info" "LICENSE"
"utf8-grammar.scm"))

View File

@@ -4,3 +4,6 @@
(release "0.0.1")
(release "0.1.0")
(release "0.1.1")
(release "0.1.2")
(release "0.1.3")

View File

@@ -198,14 +198,15 @@
const unsigned char* __restrict kb = maskkey2;
for (int i = wslen >> 2; i != 0; --i)
int i;
for (i = wslen >> 2; i != 0; --i)
{
*((unsigned int*)wsv) ^= kd;
wsv += 4;
}
const int rem = wslen & 3;
for (int i = 0; i < rem; ++i)
for (i = 0; i < rem; ++i)
{
*((unsigned int*)wsv++) ^= kb[i];
}
@@ -343,7 +344,8 @@
"
if (ws_utlen > UINT_MAX) { return -1; }
for (int i = ws_utlen; i != 0; --i)
int i;
for (i = ws_utlen; i != 0; --i)
{
if (*((unsigned char*)ws_uts++) > 127)
{
@@ -451,8 +453,13 @@
(define (process-fragments fragments optype #!optional (ws (current-websocket)))
(let ((message-body (string-concatenate/shared
(reverse (map unmask fragments)))))
(when (and (eq? optype 'text)
(not (valid-utf8? message-body)))
(when (and (or (eq? optype 'text) (eq? optype 'connection-close))
(not (valid-utf8?
(if (eq? optype 'text)
message-body
(if (> (string-length message-body) 2)
(substring message-body 2)
"")))))
(set-websocket-state! ws 'error)
(signal (make-websocket-exception
(make-property-condition
@@ -497,7 +504,10 @@
#t)
(let loop ()
(receive (data type) (receive-message ws)
(unless (eq? type 'connection-close) (loop)))))
(if (eq? type 'connection-close)
(unless (valid-utf8? data)
(set! close-reason 'invalid-data))
(loop)))))
(begin
(send-frame ws 'connection-close
(u8vector 3 (close-reason->close-code close-reason))

View File

@@ -6,4 +6,4 @@
(install-extension 'websockets
'("websockets.so" "websockets.import.so")
`((version "0.1.0")))
`((version "0.1.3")))