{"action":"created","issue":{"url":"https://api.github.com/repos/boostorg/beast/issues/1245","repository_url":"https://api.github.com/repos/boostorg/beast","labels_url":"https://api.github.com/repos/boostorg/beast/issues/1245/labels{/name}","comments_url":"https://api.github.com/repos/boostorg/beast/issues/1245/comments","events_url":"https://api.github.com/repos/boostorg/beast/issues/1245/events","html_url":"https://github.com/boostorg/beast/issues/1245","id":360460917,"node_id":"MDU6SXNzdWUzNjA0NjA5MTc=","number":1245,"title":"Invalid UTF8 payload error for valid Unicode strings","user":{"login":"bsergeev","id":2780045,"node_id":"MDQ6VXNlcjI3ODAwNDU=","avatar_url":"https://avatars1.githubusercontent.com/u/2780045?v=4","gravatar_id":"","url":"https://api.github.com/users/bsergeev","html_url":"https://github.com/bsergeev","followers_url":"https://api.github.com/users/bsergeev/followers","following_url":"https://api.github.com/users/bsergeev/following{/other_user}","gists_url":"https://api.github.com/users/bsergeev/gists{/gist_id}","starred_url":"https://api.github.com/users/bsergeev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsergeev/subscriptions","organizations_url":"https://api.github.com/users/bsergeev/orgs","repos_url":"https://api.github.com/users/bsergeev/repos","events_url":"https://api.github.com/users/bsergeev/events{/privacy}","received_events_url":"https://api.github.com/users/bsergeev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-14T21:29:58Z","updated_at":"2018-09-14T22:07:32Z","closed_at":null,"author_association":"NONE","body":"### Version of Beast\r\n1.68.0 in Windows 10 and 1.67.0 in Ubuntu 16\r\n\r\n### Steps necessary to reproduce the problem\r\nRun the code below with `#define SCENARIO 0`\r\nOther SCENARIO values demonstrate successful operation.\r\n\r\n### All relevant compiler information\r\nTested with Visual Studio 15.8.4 in Windows 10 and with GCC 6.4.0 in Ubuntu 16.04\r\n\r\n### Code\r\nThe following code is based on Boost Beast synchronous WebSocket client sample, https://www.boost.org/doc/libs/1_68_0/libs/beast/example/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp, with two differences:\r\n- the string to send to an echo server is hard-coded and controlled by SCENARIO define\r\n- CA certificates aren't loaded and `ws.next_layer().set_verify_mode(ssl::verify_none)` is executed instead.\r\n\r\n```\r\n// Show unexpected websocket::error::bad_frame_payload when receiving test_string\r\n// from a WS echo server.\r\n// Different values of SCENARIO lead to:\r\n//   0 - complete string => ERROR\r\n//   1 - only Bengali characters => success\r\n//   2 - all, except for Bengali characters => success\r\n// Just combining the Unicode strings, without enclosing ASCII (in raw string\r\n// literals below) is not enough to break UTF8 check. Only the complete string,\r\n// SCENARIO == 0, causes the error.\r\n//\r\n// Sending the complete string to an echo server from a web page\r\n//  https://websocket.org/echo.html\r\n// works fine, i.e. browser doesn't consider this Unicode string invalid\r\n#define SCENARIO 0\r\n\r\n#include <boost/beast/core.hpp>\r\n#include <boost/beast/websocket.hpp>\r\n#include <boost/beast/websocket/ssl.hpp>\r\n#include <boost/asio/connect.hpp>\r\n#include <boost/asio/ip/tcp.hpp>\r\n#include <boost/asio/ssl/stream.hpp>\r\n#include <cstdlib>\r\n#include <iostream>\r\n#include <string>\r\n\r\nusing tcp = boost::asio::ip::tcp;               // from <boost/asio/ip/tcp.hpp>\r\nnamespace ssl = boost::asio::ssl;               // from <boost/asio/ssl.hpp>\r\nnamespace websocket = boost::beast::websocket;  // from <boost/beast/websocket.hpp>\r\n\r\n// Sends a WebSocket message and prints the response\r\nint main(int, char**)\r\n{\r\n  // Characters copied from http://www.ltg.ed.ac.uk/~richard/unicode-sample.html\r\n  // then converted to HEX at https://r12a.github.io/app-conversion/\r\n  static const std::string text_japanese =\r\n    \"JAPANESE: \"\r\n    \"\\x48\\x69\\x72\\x61\\x67\\x61\\x6E\\x61\\x3A\\x20\\x28\\x49\\x72\\x6F\\x68\\x61\\x29\\x0A\\xE3\\x81\\x84\\xE3\\x82\\x8D\\xE3\\x81\\xAF\\xE3\"\r\n    \"\\x81\\xAB\\xE3\\x81\\xBB\\xE3\\x81\\xB8\\xE3\\x81\\xA8\\xE3\\x81\\xA1\\xE3\\x82\\x8A\\xE3\\x81\\xAC\\xE3\\x82\\x8B\\xE3\\x82\\x92\\x0A\\xE3\"\r\n    \"\\x82\\x8F\\xE3\\x81\\x8B\\xE3\\x82\\x88\\xE3\\x81\\x9F\\xE3\\x82\\x8C\\xE3\\x81\\x9D\\xE3\\x81\\xA4\\xE3\\x81\\xAD\\xE3\\x81\\xAA\\xE3\\x82\"\r\n    \"\\x89\\xE3\\x82\\x80\\x0A\\xE3\\x81\\x86\\xE3\\x82\\x90\\xE3\\x81\\xAE\\xE3\\x81\\x8A\\xE3\\x81\\x8F\\xE3\\x82\\x84\\xE3\\x81\\xBE\\xE3\\x81\"\r\n    \"\\x91\\xE3\\x81\\xB5\\xE3\\x81\\x93\\xE3\\x81\\x88\\xE3\\x81\\xA6\\x0A\\xE3\\x81\\x82\\xE3\\x81\\x95\\xE3\\x81\\x8D\\xE3\\x82\\x86\\xE3\\x82\"\r\n    \"\\x81\\xE3\\x81\\xBF\\xE3\\x81\\x97\\xE3\\x82\\x91\\xE3\\x81\\xB2\\xE3\\x82\\x82\\xE3\\x81\\x9B\\xE3\\x81\\x99\\x0A\\x0A\\x4B\\x61\\x74\\x61\"\r\n    \"\\x6B\\x61\\x6E\\x61\\x3A\\x0A\\xE3\\x82\\xA4\\xE3\\x83\\xAD\\xE3\\x83\\x8F\\xE3\\x83\\x8B\\xE3\\x83\\x9B\\xE3\\x83\\x98\\xE3\\x83\\x88\\x20\"\r\n    \"\\xE3\\x83\\x81\\xE3\\x83\\xAA\\xE3\\x83\\x8C\\xE3\\x83\\xAB\\xE3\\x83\\xB2\\x20\\xE3\\x83\\xAF\\xE3\\x82\\xAB\\xE3\\x83\\xA8\\xE3\\x82\\xBF\"\r\n    \"\\xE3\\x83\\xAC\\xE3\\x82\\xBD\\x20\\xE3\\x83\\x84\\xE3\\x83\\x8D\\xE3\\x83\\x8A\\xE3\\x83\\xA9\\xE3\\x83\\xA0\\x0A\\xE3\\x82\\xA6\\xE3\\x83\"\r\n    \"\\xB0\\xE3\\x83\\x8E\\xE3\\x82\\xAA\\xE3\\x82\\xAF\\xE3\\x83\\xA4\\xE3\\x83\\x9E\\x20\\xE3\\x82\\xB1\\xE3\\x83\\x95\\xE3\\x82\\xB3\\xE3\\x82\"\r\n    \"\\xA8\\xE3\\x83\\x86\\x20\\xE3\\x82\\xA2\\xE3\\x82\\xB5\\xE3\\x82\\xAD\\xE3\\x83\\xA6\\xE3\\x83\\xA1\\xE3\\x83\\x9F\\xE3\\x82\\xB7\\x20\\xE3\"\r\n    \"\\x83\\xB1\\xE3\\x83\\x92\\xE3\\x83\\xA2\\xE3\\x82\\xBB\\xE3\\x82\\xB9\\xE3\\x83\\xB3\";\r\n\r\n  static const std::string text_bengali =\r\n    \"BENGALI: \"\r\n    \"\\xE0\\xA6\\x81\\x20\\xE0\\xA6\\x82\\x20\\xE0\\xA6\\x83\\x20\\xE0\\xA6\\x85\\x20\\xE0\\xA6\\x86\\x20\\xE0\\xA6\\x87\\x20\\xE0\\xA6\\x88\\x20\"\r\n    \"\\xE0\\xA6\\x89\\x20\\xE0\\xA6\\x8A\\x20\\xE0\\xA6\\x8B\\x20\\xE0\\xA6\\x8C\\x20\\xE0\\xA6\\x8F\\x20\\xE0\\xA6\\x90\\x20\\xE0\\xA6\\x93\\x20\"\r\n    \"\\xE0\\xA6\\x94\\x20\\xE0\\xA6\\x95\\x20\\xE0\\xA6\\x96\\x20\\xE0\\xA6\\x97\\x20\\xE0\\xA6\\x98\\x20\\xE0\\xA6\\x99\\x20\\xE0\\xA6\\x9A\\x20\"\r\n    \"\\xE0\\xA6\\x9B\\x20\\xE0\\xA6\\x9C\\x20\\xE0\\xA6\\x9D\\x20\\xE0\\xA6\\x9E\\x20\\xE0\\xA6\\x9F\\x20\\xE0\\xA6\\xA0\\x20\\xE0\\xA6\\xA1\\x20\"\r\n    \"\\xE0\\xA6\\xA2\\x20\\xE0\\xA6\\xA3\\x20\\xE0\\xA6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\\xB3\\x20\\xE0\\xA7\\xB4\\x20\\xE0\\xA7\\xB5\\x20\"\r\n    \"\\xE0\\xA7\\xB6\\x20\\xE0\\xA7\\xB7\\x20\\xE0\\xA7\\xB8\\x20\\xE0\\xA7\\xB9\\x20\\xE0\\xA7\\xBA\";\r\n\r\n\r\n  static const std::string text_enclosed_alphanumerics =\r\n    \"ENCLOSED ALPHANUM: \"\r\n    \"\\xE2\\x91\\xA0\\x20\\xE2\\x91\\xA1\\x20\\xE2\\x91\\xA2\\x20\\xE2\\x91\\xA3\\x20\\xE2\\x91\\xA4\\x20\\xE2\\x91\\xA5\\x20\\xE2\\x91\\xA6\\x20\"\r\n    \"\\xE2\\x91\\xA7\\x20\\xE2\\x91\\xA8\\x20\\xE2\\x91\\xA9\\x20\\xE2\\x91\\xAA\\x20\\xE2\\x91\\xAB\\x20\\xE2\\x91\\xAC\\x20\\xE2\\x91\\xAD\\x20\"\r\n    \"\\xE2\\x91\\xAE\\x20\\xE2\\x91\\xAF\\x20\\xE2\\x91\\xB0\\x20\\xE2\\x91\\xB1\\x20\\xE2\\x91\\xB2\\x20\\xE2\\x91\\xB3\\x20\\xE2\\x91\\xB4\\x20\"\r\n    \"\\xE2\\x91\\xB5\\x20\\xE2\\x91\\xB6\\x20\\xE2\\x91\\xB7\\x20\\xE2\\x91\\xB8\\x20\\xE2\\x91\\xB9\\x20\\xE2\\x91\\xBA\\x20\\xE2\\x91\\xBB\\x20\"\r\n    \"\\xE2\\x91\\xBC\\x20\\xE2\\x91\\xBD\\x20\\xE2\\x91\\xBE\\x20\\xE2\\x91\\xBF\\x20\\xE2\\x92\\x80\\x20\\xE2\\x92\\x81\\x20\\xE2\\x92\\x82\\x20\"\r\n    \"\\xE2\\x92\\x83\\x20\\xE2\\x92\\x84\\x20\\xE2\\x92\\x85\\x20\\xE2\\x92\\x86\\x20\\xE2\\x92\\x87\\x20\\xE2\\x92\\x88\\x20\\xE2\\x92\\x89\\x20\"\r\n    \"\\xE2\\x92\\x8A\\x20\\xE2\\x92\\x8B\\x20\\xE2\\x92\\x8C\\x20\\xE2\\x92\\x8D\\x20\\xE2\\x92\\x8E\\x20\\xE2\\x92\\x8F\\x20\\xE2\\x92\\x90\\x20\"\r\n    \"\\xE2\\x92\\x91\\x20\\xE2\\x92\\x92\\x20\\xE2\\x92\\x93\\x20\\xE2\\x92\\x94\\x20\\xE2\\x92\\x95\\x20\\xE2\\x92\\x96\\x20\\xE2\\x92\\x97\\x20\"\r\n    \"\\xE2\\x92\\x98\\x20\\xE2\\x92\\x99\\x20\\xE2\\x92\\x9A\\x20\\xE2\\x92\\x9B\\x20\\xE2\\x92\\x9C\\x20\\xE2\\x92\\x9D\\x20\\xE2\\x92\\x9E\\x20\"\r\n    \"\\xE2\\x92\\x9F\\x20\\xE2\\x92\\xA0\\x20\\xE2\\x92\\xA1\\x20\\xE2\\x92\\xA2\\x20\\xE2\\x92\\xA3\\x20\\xE2\\x92\\xA4\\x20\\xE2\\x92\\xA5\\x20\"\r\n    \"\\xE2\\x92\\xA6\\x20\\xE2\\x92\\xA7\\x20\\xE2\\x92\\xA8\\x20\\xE2\\x92\\xA9\\x20\\xE2\\x92\\xAA\\x20\\xE2\\x92\\xAB\\x20\\xE2\\x92\\xAC\\x20\"\r\n    \"\\xE2\\x92\\xAD\\x20\\xE2\\x92\\xAE\\x20\\xE2\\x92\\xAF\\x20\\xE2\\x92\\xB0\\x20\\xE2\\x92\\xB1\\x20\\xE2\\x92\\xB2\\x20\\xE2\\x92\\xB3\\x20\"\r\n    \"\\xE2\\x92\\xB4\\x20\\xE2\\x92\\xB5\\x20\\xE2\\x92\\xB6\\x20\\xE2\\x92\\xB7\\x20\\xE2\\x92\\xB8\\x20\\xE2\\x92\\xB9\\x20\\xE2\\x92\\xBA\\x20\"\r\n    \"\\xE2\\x92\\xBB\\x20\\xE2\\x92\\xBC\\x20\\xE2\\x92\\xBD\\x20\\xE2\\x92\\xBE\\x20\\xE2\\x92\\xBF\\x20\\xE2\\x93\\x80\\x20\\xE2\\x93\\x81\\x20\"\r\n    \"\\xE2\\x93\\x82\\x20\\xE2\\x93\\x83\\x20\\xE2\\x93\\x84\\x20\\xE2\\x93\\x85\\x20\\xE2\\x93\\x86\\x20\\xE2\\x93\\x87\\x20\\xE2\\x93\\x88\\x20\"\r\n    \"\\xE2\\x93\\x89\\x20\\xE2\\x93\\x8A\\x20\\xE2\\x93\\x8B\\x20\\xE2\\x93\\x8C\\x20\\xE2\\x93\\x8D\\x20\\xE2\\x93\\x8E\\x20\\xE2\\x93\\x8F\\x20\"\r\n    \"\\xE2\\x93\\x90\\x20\\xE2\\x93\\x91\\x20\\xE2\\x93\\x92\\x20\\xE2\\x93\\x93\\x20\\xE2\\x93\\x94\\x20\\xE2\\x93\\x95\\x20\\xE2\\x93\\x96\\x20\"\r\n    \"\\xE2\\x93\\x97\\x20\\xE2\\x93\\x98\\x20\\xE2\\x93\\x99\\x20\\xE2\\x93\\x9A\\x20\\xE2\\x93\\x9B\\x20\\xE2\\x93\\x9C\\x20\\xE2\\x93\\x9D\\x20\"\r\n    \"\\xE2\\x93\\x9E\\x20\\xE2\\x93\\x9F\";\r\n\r\n  static const std::string text_cjk_unified_ideographs =\r\n    \"CJK UNIFIED IDEOGRAPHS: \"\r\n    \"\\xE4\\xB8\\x80\\x20\\xE4\\xB8\\x81\\x20\\xE4\\xB8\\x82\\x20\\xE4\\xB8\\x83\\x20\\xE4\\xB8\\x84\\x20\\xE4\\xB8\\x85\\x20\\xE4\\xB8\\x86\\x20\"\r\n    \"\\xE4\\xB8\\x87\\x20\\xE4\\xB8\\x88\\x20\\xE4\\xB8\\x89\\x20\\xE4\\xB8\\x8A\\x20\\xE4\\xB8\\x8B\\x20\\xE4\\xB8\\x8C\\x20\\xE4\\xB8\\x8D\\x20\"\r\n    \"\\xE4\\xB8\\x8E\\x20\\xE4\\xB8\\x8F\\x20\\xE4\\xB8\\x90\\x20\\xE4\\xB8\\x91\\x20\\xE4\\xB8\\x92\\x20\\xE4\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B9\\xB9\\x20\\xE4\\xB9\\xBA\\x20\\xE4\\xB9\\xBB\\x20\\xE4\\xB9\\xBC\\x20\\xE4\\xB9\\xBD\\x20\"\r\n    \"\\xE4\\xB9\\xBE\\x20\\xE4\\xB9\\xBF\";\r\n\r\n  static const std::string text_thai =\r\n    \"THAI: \"\r\n    \"\\xE0\\xB8\\x81\\x20\\xE0\\xB8\\x82\\x20\\xE0\\xB8\\x83\\x20\\xE0\\xB8\\x84\\x20\\xE0\\xB8\\x85\\x20\\xE0\\xB8\\x86\\x20\\xE0\\xB8\\x87\\x20\"\r\n    \"\\xE0\\xB8\\x88\\x20\\xE0\\xB8\\x89\\x20\\xE0\\xB8\\x8A\\x20\\xE0\\xB8\\x8B\\x20\\xE0\\xB8\\x8C\\x20\\xE0\\xB8\\x8D\\x20\\xE0\\xB8\\x8E\\x20\"\r\n    \"\\xE0\\xB8\\x8F\\x20\\xE0\\xB8\\x90\\x20\\xE0\\xB8\\x91\\x20\\xE0\\xB8\\x92\\x20\\xE0\\xB8\\x93\\x20\\xE0\\xB8\\x94\\x20\\xE0\\xB8\\x95\\x20\"\r\n    \"\\xE0\\xB8\\x96\\x20\\xE0\\xB8\\x97\\x20\\xE0\\xB8\\x98\\x20\\xE0\\xB8\\x99\\x20\\xE0\\xB8\\x9A\\x20\\xE0\\xB8\\x9B\\x20\\xE0\\xB8\\x9C\\x20\"\r\n    \"\\xE0\\xB8\\x9D\\x20\\xE0\\xB8\\x9E\\x20\\xE0\\xB8\\x9F\\x20\\xE0\\xB8\\xA0\\x20\\xE0\\xB8\\xA1\\x20\\xE0\\xB8\\xA2\\x20\\xE0\\xB8\\xA3\\x20\"\r\n    \"\\xE0\\xB8\\xA4\\x20\\xE0\\xB8\\xA5\\x20\\xE0\\xB8\\xA6\\x20\\xE0\\xB8\\xA7\\x20\\xE0\\xB8\\xA8\\x20\\xE0\\xB8\\xA9\\x20\\xE0\\xB8\\xAA\\x20\"\r\n    \"\\xE0\\xB8\\xAB\\x20\\xE0\\xB8\\xAC\\x20\\xE0\\xB8\\xAD\\x20\\xE0\\xB8\\xAE\\x20\\xE0\\xB8\\xAF\\x20\\xE0\\xB8\\xB0\\x20\\xE0\\xB8\\xB1\\x20\"\r\n    \"\\xE0\\xB8\\xB2\\x20\\xE0\\xB8\\xB3\\x20\\xE0\\xB8\\xB4\\x20\\xE0\\xB8\\xB5\\x20\\xE0\\xB8\\xB6\\x20\\xE0\\xB8\\xB7\\x20\\xE0\\xB8\\xB8\\x20\"\r\n    \"\\xE0\\xB8\\xB9\\x20\\xE0\\xB8\\xBA\\x20\\xE0\\xB8\\xBF\\x20\\xE0\\xB9\\x80\\x20\\xE0\\xB9\\x81\\x20\\xE0\\xB9\\x82\\x20\\xE0\\xB9\\x83\\x20\"\r\n    \"\\xE0\\xB9\\x84\\x20\\xE0\\xB9\\x85\\x20\\xE0\\xB9\\x86\\x20\\xE0\\xB9\\x87\\x20\\xE0\\xB9\\x88\\x20\\xE0\\xB9\\x89\\x20\\xE0\\xB9\\x8A\\x20\"\r\n    \"\\xE0\\xB9\\x8B\\x20\\xE0\\xB9\\x8C\\x20\\xE0\\xB9\\x8D\\x20\\xE0\\xB9\\x8E\\x20\\xE0\\xB9\\x8F\\x20\\xE0\\xB9\\x90\\x20\\xE0\\xB9\\x91\\x20\"\r\n    \"\\xE0\\xB9\\x92\\x20\\xE0\\xB9\\x93\\x20\\xE0\\xB9\\x94\\x20\\xE0\\xB9\\x95\\x20\\xE0\\xB9\\x96\\x20\\xE0\\xB9\\x97\\x20\\xE0\\xB9\\x98\\x20\"\r\n    \"\\xE0\\xB9\\x99\\x20\\xE0\\xB9\\x9A\\x20\\xE0\\xB9\\x9B\";\r\n\r\n  try\r\n    {\r\n        auto const host = \"echo.websocket.org\";\r\n        auto const port = \"443\";\r\n        const std::string test_string = \r\n#if (SCENARIO != 1)\r\n          R\"crap(432[null,{\"commits\":[{\"guid\":\"ea65a736-2679-02da-c76b-683330a373f3\",\"urn\":\"urn:adsk.lynx:commit:ea65a736-2679-02da-c76b-683330a373f3:branch:7b10c530-d031-939b-b867-2442da90add4\",\"changeSet\":{\"insert\":{\"autodesk.samples:string_sample.string-1.0.0\":{\"ASCII:0\":{\"String\":{\"guid\":\"f3638ebf-c44d-4d37-adf6-44bb74597d84\",\"string\":\"ASCII Simple\"}},\"ASCII:1\":{\"String\":{\"guid\":\"c5e41ea6-0393-49aa-80ad-8b6d6d6965fa\",\"string\":\"ASCII Test\"}},\"ASCII:2\":{\"String\":{\"guid\":\"43354fa0-b864-40a9-a54b-cce2533a60be\",\"string\":\"ASCII Why so blue,\"}},\"ASCII:3\":{\"String\":{\"guid\":\"55bb5a52-8f66-44aa-9873-4908c5644ab1\",\"string\":\"ASCII Panda Bear?\"}},\"ASCII:4\":{\"String\":{\"guid\":\"ac1a479e-c260-4ad4-80d4-2e2ef2c464ff\",\"string\":\"ASCII LATIN: ! \\\" # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \\\\ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~\"}},\"nonASCII:0\":{\"String\":{\"guid\":\"ba6961aa-20b8-48fa-ad57-4e7a5b2105e2\",\"string\":)crap\"\r\n          + text_japanese +\r\n          R\"crap(}},\"nonASCII:1\" : {\"String\":{\"guid\":\"38fa41e7-47ef-4fdd-8be8-f7e46d5e107d\",\"string\":)crap\" +\r\n#endif\r\n#if (SCENARIO != 2)\r\n          text_bengali\r\n#endif\r\n#if (SCENARIO == 0)\r\n          +\r\n#endif\r\n#if (SCENARIO != 1)\r\n          R\"crap(}},\"nonASCII:2\":{\"String\":{\"guid\":\"cbb825a4-8e13-43d5-bbd7-db01c31de904\",\"string\":)crap\"\r\n          + text_enclosed_alphanumerics +\r\n          R\"crap(}},\"nonASCII:3\":{\"String\":{\"guid\":\"3ada2a0d-5ff2-4724-bfb2-30fae4694e6b\",\"string\":)crap\"\r\n          + text_cjk_unified_ideographs +\r\n          R\"crap(}},\"nonASCII:4\":{\"String\":{\"guid\":\"0a737e3c-26d9-43b9-9ea3-715ed5b5cb87\",\"string\":)crap\"\r\n          + text_thai +\r\n          R\"crap(}}},\"autodesk.samples:string_sample.customProperty-1.0.0\":{\"custom\":{\"String\":{\"guid\":\"4addafc6-ea79-4e9c-94df-c289ce7ad5a5\"}}}},\"insertTemplates\":{\"autodesk.samples:string_sample.string-1.0.0\":{\"inherits\":[\"NamedProperty\"],\"properties\":[{\"id\":\"string\",\"typeid\":\"String\"}],\"typeid\":\"autodesk.samples:string_sample.string-1.0.0\"},\"autodesk.samples:string_sample.customProperty-1.0.0\":{\"inherits\":[\"NamedProperty\"],\"properties\":[{\"context\":\"array\",\"id\":\"arrayOfCustom\",\"typeid\":\"autodesk.samples:string_sample.string-1.0.0\"},{\"context\":\"map\",\"id\":\"mapOfCustom\",\"typeid\":\"autodesk.samples:string_sample.string-1.0.0\"},{\"context\":\"array\",\"id\":\"arrayOfString\",\"typeid\":\"String\"},{\"context\":\"map\",\"id\":\"mapOfString\",\"typeid\":\"String\"}],\"typeid\":\"autodesk.samples:string_sample.customProperty-1.0.0\"}}},\"meta\":{},\"sequence\":4,\"creatorId\":\"Service:User_Good\"}],\"container\":{\"guid\":\"af60f6d8-7708-710c-dea3-efb8b63d300a\",\"urn\":\"urn:adsk.lynx:repository:af60f6d8-7708-710c-dea3-efb8b63d300a\",\"creatorId\":\"Service:User_Good\"},\"branch\":{\"guid\":\"7b10c530-d031-939b-b867-2442da90add4\",\"urn\":\"urn:adsk.lynx:branch:7b10c530-d031-939b-b867-2442da90add4\",\"creatorId\":\"Service:User_Good\"},\"rootCommit\":{\"guid\":\"dbc48256-1e5b-5412-e9c9-c9977d2f2a88\",\"urn\":\"urn:adsk.lynx:commit:dbc48256-1e5b-5412-e9c9-c9977d2f2a88:branch:7b10c530-d031-939b-b867-2442da90add4\",\"sequence\":0},\"room\":{\"name\":\"7b10c530-d031-939b-b867-2442da90add4\",\"properties\":{\"rootCommit\":true,\"containerInfo\":true,\"flatten\":true,\"roomType\":\"branch\"},\"collaborators\":[{\"guid\":\"4a61e6d0-310b-c584-71b7-d98a5ea33fa2\",\"type\":\"human\"}]}}])crap\"\r\n#endif\r\n;\r\n        // The io_context is required for all I/O\r\n        boost::asio::io_context ioc;\r\n\r\n        // The SSL context is required, and holds certificates\r\n        ssl::context ctx{ssl::context::sslv23_client};\r\n\r\n        // These objects perform our I/O\r\n        tcp::resolver resolver{ioc};\r\n        websocket::stream<ssl::stream<tcp::socket>> ws{ioc, ctx};\r\n\r\n        ws.next_layer().set_verify_mode(ssl::verify_none);\r\n\r\n        // Look up the domain name\r\n        auto const results = resolver.resolve(host, port);\r\n\r\n        // Make the connection on the IP address we get from a lookup\r\n        boost::asio::connect(ws.next_layer().next_layer(), results.begin(), results.end());\r\n\r\n        // Perform the SSL handshake\r\n        ws.next_layer().handshake(ssl::stream_base::client);\r\n\r\n        // Perform the websocket handshake\r\n        ws.handshake(host, \"/\");\r\n\r\n        // Send the message\r\n        ws.write(boost::asio::buffer(std::string(test_string)));\r\n\r\n        // This buffer will hold the incoming message\r\n        boost::beast::multi_buffer b;\r\n\r\n        // Read a message into our buffer\r\n        ws.read(b);\r\n\r\n        // Close the WebSocket connection\r\n        ws.close(websocket::close_code::normal);\r\n\r\n        // If we get here then the connection is closed gracefully\r\n\r\n        // The buffers() function helps print a ConstBufferSequence\r\n        std::cout << boost::beast::buffers(b.data()) << std::endl;\r\n    }\r\n    catch(std::exception const& e)\r\n    {\r\n        std::cerr << \"Error: \" << e.what() << std::endl;\r\n        return EXIT_FAILURE;\r\n    }\r\n    return EXIT_SUCCESS;\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/boostorg/beast/issues/comments/421496902","html_url":"https://github.com/boostorg/beast/issues/1245#issuecomment-421496902","issue_url":"https://api.github.com/repos/boostorg/beast/issues/1245","id":421496902,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMTQ5NjkwMg==","user":{"login":"vinniefalco","id":1503976,"node_id":"MDQ6VXNlcjE1MDM5NzY=","avatar_url":"https://avatars3.githubusercontent.com/u/1503976?v=4","gravatar_id":"","url":"https://api.github.com/users/vinniefalco","html_url":"https://github.com/vinniefalco","followers_url":"https://api.github.com/users/vinniefalco/followers","following_url":"https://api.github.com/users/vinniefalco/following{/other_user}","gists_url":"https://api.github.com/users/vinniefalco/gists{/gist_id}","starred_url":"https://api.github.com/users/vinniefalco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinniefalco/subscriptions","organizations_url":"https://api.github.com/users/vinniefalco/orgs","repos_url":"https://api.github.com/users/vinniefalco/repos","events_url":"https://api.github.com/users/vinniefalco/events{/privacy}","received_events_url":"https://api.github.com/users/vinniefalco/received_events","type":"User","site_admin":false},"created_at":"2018-09-14T22:07:32Z","updated_at":"2018-09-14T22:07:32Z","author_association":"MEMBER","body":"Unfortunately, you're going to need to look into this one yourself. I'll help you. This is the UTF8 validation code:\r\nhttps://github.com/boostorg/beast/blob/1da229a27c6f0539d422bcedbcf47cfe2517164a/include/boost/beast/websocket/detail/utf8_checker.hpp#L102\r\n\r\nThese are the tests for it:\r\nhttps://github.com/boostorg/beast/blob/develop/test/beast/websocket/utf8_checker.cpp\r\n\r\nWhat I would suggest, is to write a test which fails for your input data. This should be pretty easy just create an instance of `utf8_checker` and call `write` on it with your buffer. Then call `finish`. Then, trim the input data to the smallest possible string which contains only complete code points and still fails.\r\n\r\nOnce we have the MVCE (minimum viable compiling example) then we can look at the code together and try to figure out what went wrong.\r\n\r\nThanks\r\n"}}
{"actor":{"display_login":"vinniefalco"}}