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

前端 未结 1 698
Happy的楠姐
Happy的楠姐 2021-01-13 15:13

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/

相关标签:
1条回答
  • 2021-01-13 15:50

    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);
    
    0 讨论(0)
提交回复
热议问题