aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2017-02-06 19:45:03 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2017-02-06 19:45:03 +0100
commit9afcb337ada91f87aa1a566ec3feba1a12bc9287 (patch)
treef990119e747f44ad353c476c41995ce47977c04d
parentdaa900e12f1bccbe7a41d4c3884b4cd42255989b (diff)
downloadliberty-9afcb337ada91f87aa1a566ec3feba1a12bc9287.tar.gz
liberty-9afcb337ada91f87aa1a566ec3feba1a12bc9287.tar.xz
liberty-9afcb337ada91f87aa1a566ec3feba1a12bc9287.zip
Fix the WebSocket frame parser
-rw-r--r--liberty-proto.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/liberty-proto.c b/liberty-proto.c
index 67c5cde..aa996de 100644
--- a/liberty-proto.c
+++ b/liberty-proto.c
@@ -1275,10 +1275,7 @@ ws_parser_push (struct ws_parser *self, const void *data, size_t len)
case WS_PARSER_PAYLOAD:
// Move the buffer so that payload data is at the front
str_remove_slice (&self->input, 0, unpacker.offset);
-
- // And continue unpacking frames past the payload
msg_unpacker_init (&unpacker, self->input.str, self->input.len);
- unpacker.offset = self->payload_len;
if (self->input.len < self->payload_len)
goto need_data;
@@ -1287,6 +1284,8 @@ ws_parser_push (struct ws_parser *self, const void *data, size_t len)
if (!self->on_frame (self->user_data, self))
goto fail;
+ // And continue unpacking frames past the payload
+ unpacker.offset = self->payload_len;
self->state = WS_PARSER_FIXED;
break;
}