3 Commits
0.1.0 ... 0.1.2

Author SHA1 Message Date
23cecce39d Requiring at least spiffy 5.3.1. 2014-10-22 06:51:47 -07:00
d8ee592823 Release version 0.1.1. 2014-10-18 11:00:32 -07:00
221d2d0e6e Failing connection on invalid UTF8 in close reason. 2014-10-18 10:59:34 -07:00
4 changed files with 15 additions and 5 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,5 @@
(release "0.0.1")
(release "0.1.0")
(release "0.1.1")
(release "0.1.2")

View File

@@ -451,8 +451,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 +502,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.2")))