From: Jan Nieuwenhuizen Date: Mon, 27 Jan 2020 17:35:12 +0000 (+0100) Subject: websocket: Also concatenate last fragmented frame. X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=e6d0f43cb80edc0ce864c7f54ec41bee6fd2f3c8;p=8sync.git websocket: Also concatenate last fragmented frame. * 8sync/systems/websocket/server.scm (websocket-client-loop): Also add final fragmented frame. --- diff --git a/8sync/systems/websocket/server.scm b/8sync/systems/websocket/server.scm index 6283255..af0fe1f 100644 --- a/8sync/systems/websocket/server.scm +++ b/8sync/systems/websocket/server.scm @@ -1,6 +1,7 @@ ;;; guile-websocket --- WebSocket client/server ;;; Copyright © 2015 David Thompson ;;; Copyright © 2017 Christopher Allan Webber +;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of guile-websocket. ;;; @@ -156,11 +157,11 @@ called for each complete message that is received." (loop fragments type)) ((first-fragment-frame? frame) ; begin accumulating fragments (loop (list frame) (frame-type frame))) + ((fragment-frame? frame) ; add a fragment + (loop (cons frame fragments) type)) ((final-fragment-frame? frame) ; concatenate all fragments (handle-data-frame type (frame-concatenate (reverse fragments))) (loop '() #f)) - ((fragment-frame? frame) ; add a fragment - (loop (cons frame fragments) type)) ((data-frame? frame) ; unfragmented data frame (handle-data-frame (frame-type frame) (frame-data frame)) (loop '() #f)))))))