{"action":"created","issue":{"url":"https://api.github.com/repos/mojolicious/mojo/issues/1259","repository_url":"https://api.github.com/repos/mojolicious/mojo","labels_url":"https://api.github.com/repos/mojolicious/mojo/issues/1259/labels{/name}","comments_url":"https://api.github.com/repos/mojolicious/mojo/issues/1259/comments","events_url":"https://api.github.com/repos/mojolicious/mojo/issues/1259/events","html_url":"https://github.com/mojolicious/mojo/issues/1259","id":359870832,"node_id":"MDU6SXNzdWUzNTk4NzA4MzI=","number":1259,"title":"Transaction/Websocket.pm does not handle compressed messages with multiple frames correctly","user":{"login":"mgruner","id":211281,"node_id":"MDQ6VXNlcjIxMTI4MQ==","avatar_url":"https://avatars3.githubusercontent.com/u/211281?v=4","gravatar_id":"","url":"https://api.github.com/users/mgruner","html_url":"https://github.com/mgruner","followers_url":"https://api.github.com/users/mgruner/followers","following_url":"https://api.github.com/users/mgruner/following{/other_user}","gists_url":"https://api.github.com/users/mgruner/gists{/gist_id}","starred_url":"https://api.github.com/users/mgruner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgruner/subscriptions","organizations_url":"https://api.github.com/users/mgruner/orgs","repos_url":"https://api.github.com/users/mgruner/repos","events_url":"https://api.github.com/users/mgruner/events{/privacy}","received_events_url":"https://api.github.com/users/mgruner/received_events","type":"User","site_admin":false},"labels":[{"id":85884,"node_id":"MDU6TGFiZWw4NTg4NA==","url":"https://api.github.com/repos/mojolicious/mojo/labels/bug","name":"bug","color":"ff0000","default":true},{"id":289647972,"node_id":"MDU6TGFiZWwyODk2NDc5NzI=","url":"https://api.github.com/repos/mojolicious/mojo/labels/help%20wanted","name":"help wanted","color":"d4c5f9","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-09-13T12:19:00Z","updated_at":"2018-09-14T14:46:01Z","closed_at":"2018-09-14T14:46:01Z","author_association":"NONE","body":"* Mojolicious version: 7.93 (7.94 uses the same code and would also have the same problem)\r\n* Perl version: v5.18.2\r\n* Operating system: Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64\r\n\r\n### Steps to reproduce the behavior\r\n\r\nSend a compressed web socket message with multiple frames from Chrome to Mojolicious.\r\n\r\n### Expected behavior\r\n\r\nMessages are handled correctly.\r\n\r\n### Actual behavior\r\n\r\nCompressed web socket messages sent from Chrome (69) with more than one frame cause the connection to become corrupt. The client sees a 400 bad request.\r\n\r\nIt does seem to work with Firefox atm.\r\n\r\n### Suggestion\r\n\r\nAccording to https://tools.ietf.org/html/rfc7692, \"the RSV1 bit is set only on the first frame.\"\r\nMojo's code accepts it on the final frame though. Therefore it works for one-frame sized messages, but not for messages with more than one frame.\r\n\r\nThis is how I see it also with some debug code that outputs the frame[0-4] fields:\r\n\r\n```\r\nparse_message frame 1 1 0 0 1     # one-frame compressed message, works fine\r\n\r\nparse_message frame 0 1 0 0 1     # first frame of two-frame compressed message, RSV1 set\r\nparse_message frame 1 0 0 0 0     # second and final frame, RSV1 not set, therefore not decompressed\r\n```\r\n\r\nIt probably works in Firefox because it keeps sending RSV1, contrary to the specification.\r\n\r\nIf I change this in parse_message, it starts working correctly (obviously this cannot be a final fix):\r\n\r\n``` \r\n  #if ($self->compressed && $frame->[1]) {\r\n  if ($self->compressed) {\r\n```\r\n\r\nFor a real solution, the RSV1 bit of the first frame probably needs to be remembered and used for determining the need to decompress the message.\r\n\r\nThanks for considering, and please let me know if I can provide any further information."},"comment":{"url":"https://api.github.com/repos/mojolicious/mojo/issues/comments/421381656","html_url":"https://github.com/mojolicious/mojo/issues/1259#issuecomment-421381656","issue_url":"https://api.github.com/repos/mojolicious/mojo/issues/1259","id":421381656,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMTM4MTY1Ng==","user":{"login":"kraih","id":30094,"node_id":"MDQ6VXNlcjMwMDk0","avatar_url":"https://avatars3.githubusercontent.com/u/30094?v=4","gravatar_id":"","url":"https://api.github.com/users/kraih","html_url":"https://github.com/kraih","followers_url":"https://api.github.com/users/kraih/followers","following_url":"https://api.github.com/users/kraih/following{/other_user}","gists_url":"https://api.github.com/users/kraih/gists{/gist_id}","starred_url":"https://api.github.com/users/kraih/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kraih/subscriptions","organizations_url":"https://api.github.com/users/kraih/orgs","repos_url":"https://api.github.com/users/kraih/repos","events_url":"https://api.github.com/users/kraih/events{/privacy}","received_events_url":"https://api.github.com/users/kraih/received_events","type":"User","site_admin":false},"created_at":"2018-09-14T14:46:01Z","updated_at":"2018-09-14T14:46:01Z","author_association":"MEMBER","body":"Thanks, this should be resolved now."}}
{"actor":{"display_login":"kraih"}}