From 4b845bf0199e20dc3d806be8d79f1ae79ae14c75 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Tue, 2 Apr 2024 14:10:16 -0400 Subject: [PATCH] debug in websocket --- src/ws/tiny_httpd_ws.ml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ws/tiny_httpd_ws.ml b/src/ws/tiny_httpd_ws.ml index bf12ef2f..54dc1481 100644 --- a/src/ws/tiny_httpd_ws.ml +++ b/src/ws/tiny_httpd_ws.ml @@ -314,10 +314,11 @@ module Reader = struct n | Begin -> read_frame_header self; - (*Log.debug (fun k -> + Log.debug (fun k -> k "websocket: read frame of type=%s payload_len=%d" (Frame_type.show self.header.ty) - self.header.payload_len);*) + self.header.payload_len); + (match self.header.ty with | 0 -> (* continuation *) @@ -332,10 +333,12 @@ module Reader = struct ); read_rec self buf i len | 1 -> + (* text *) self.state <- Reading_frame { remaining_bytes = self.header.payload_len }; read_rec self buf i len | 2 -> + (* binary *) self.state <- Reading_frame { remaining_bytes = self.header.payload_len }; read_rec self buf i len @@ -351,7 +354,7 @@ module Reader = struct ); 0 | 9 -> - (* pong, just ignore *) + (* ping, reply *) skip_body self; Writer.send_pong self.writer; read_rec self buf i len