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

匿名 (未验证) 提交于 2019-12-03 08:59:04

问题:

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); 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!