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 = "HTTP/1.1 200 OK\r\n" "Content-Length: 5\r\n" "\r\n" "*****"; error_code ec; request_parser<string_body> p; p.put(boost::asio::buffer(s), ec);