boost-beast

C++ Boost 1.66 using Beast http request Parser for parsing an string

余生长醉 提交于 2019-12-01 06:38:17
I'm not using beast http server in my project but I was searching for a solution to parse an http request in form of std::string in my program ,is it possible to use boost/beast/http/parser.hpp in this case and if so it would be Great if you give an example in code. Thanks aloot Yes it is possible: std::string s = "POST /cgi/message.php HTTP/1.1\r\n" "Content-Length: 5\r\n" "\r\n" "abcde"; error_code ec; request_parser<string_body> p; p.put(boost::asio::buffer(s), ec); 来源: https://stackoverflow.com/questions/49756730/c-boost-1-66-using-beast-http-request-parser-for-parsing-an-string

C++ Boost 1.66 using Beast http request Parser for parsing an string

混江龙づ霸主 提交于 2019-12-01 04:24:29
问题 I'm not using beast http server in my project but I was searching for a solution to parse an http request in form of std::string in my program ,is it possible to use boost/beast/http/parser.hpp in this case and if so it would be Great if you give an example in code. Thanks aloot 回答1: Yes it is possible: std::string s = "POST /cgi/message.php HTTP/1.1\r\n" "Content-Length: 5\r\n" "\r\n" "abcde"; error_code ec; request_parser<string_body> p; p.put(boost::asio::buffer(s), ec); 来源: https:/