X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=8sync%2Fsystems%2Fwebsocket%2Fframe.scm;h=35dc5511aec13da172bdb637be1337b6f466b20b;hb=4eb04372da31d1b47138bf0393d8e11db9299052;hp=7a71dba9ff56483b44c222edef00b58e4d439280;hpb=c7a6683e7ba2377909f37bc6dc11d49f43369191;p=8sync.git diff --git a/8sync/systems/websocket/frame.scm b/8sync/systems/websocket/frame.scm index 7a71dba..35dc551 100644 --- a/8sync/systems/websocket/frame.scm +++ b/8sync/systems/websocket/frame.scm @@ -1,5 +1,6 @@ ;;; guile-websocket --- WebSocket client/server ;;; Copyright © 2015 David Thompson +;;; Copyright © 2019 Rutger van Beusekom ;;; ;;; This file is part of guile-websocket. ;;; @@ -105,16 +106,16 @@ bytevector BV, masked with MASKING-KEY. By default, the data is unmasked." (make-frame #t 'close masking-key bv)) -(define* (make-text-frame text #:optional masking-key) +(define* (make-text-frame text #:optional masking-key #:key (final? #t) (continuation? #f)) ;; bah: optional "Return a text data frame containing the string TEXT, masked with MASKING-KEY. By default, the text is unmasked." - (make-frame #t 'text masking-key (string->utf8 text))) + (make-frame final? (if continuation? 'continuation 'text) masking-key (string->utf8 text))) -(define* (make-binary-frame bv #:optional masking-key) +(define* (make-binary-frame bv #:optional masking-key #:key (final? #t) (continuation? #f)) "Return a binary data frame containing the contents of the bytevector BV, masked with MASKING-KEY. By default, the data is unmasked." - (make-frame #t 'binary masking-key bv)) + (make-frame final? (if continuation? 'continuation 'binary) masking-key bv)) (define (continuation-frame? frame) "Return #t if FRAME is a continuation frame." @@ -309,7 +310,8 @@ MASKING-KEY." (let ((bv (get-bytevector-n port length))) (when masking-key - (mask-bytevector! bv masking-key)) + (unless (eof-object? bv) + (mask-bytevector! bv masking-key))) bv)) (let* ((type-byte (get-u8 port))