;;; guile-websocket --- WebSocket client/server
;;; Copyright © 2015 David Thompson <davet@gnu.org>
+;;; Copyright © 2017 Christopher Allan Webber <cwebber@dustycloud.org>
+;;; Copyright © 2020,2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;;
;;; This file is part of guile-websocket.
;;;
((ws-send websocket-server-send))
(upgrade-paths #:init-value `(("websocket" .
,(wrap-apply websocket-client-loop)))
- #:allocation #:each-subclass
- #:accessor .upgrade-paths)
+ #:allocation #:each-subclass)
(gen-client-id #:init-thunk make-simple-counter)
(let ((frame (read-frame-maybe)))
(cond
;; EOF - port is closed.
- ((not frame)
+ ;; @@: Sometimes the eof object appears here as opposed to
+ ;; at lookahead, but I'm not sure why
+ ((or (not frame) (eof-object? frame))
(close-down))
;; Per section 5.4, control frames may appear interspersed
;; along with a fragmented message.
((first-fragment-frame? frame) ; begin accumulating fragments
(loop (list frame) (frame-type frame)))
((final-fragment-frame? frame) ; concatenate all fragments
- (handle-data-frame type (frame-concatenate (reverse fragments)))
+ (handle-data-frame type (frame-concatenate
+ (reverse (cons frame fragments))))
(loop '() #f))
((fragment-frame? frame) ; add a fragment
(loop (cons frame fragments) type))