Advertisement
bueddl

Untitled

Sep 26th, 2015
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. protocol::http::request::request request;
  2. protocol::http::request::parser parser(expr);
  3.  
  4. if (!parser.parse(request))
  5.     ; // TODO: throw
  6.  
  7. const auto &header = request.header_;
  8. if (header.connection == "Upgrade")
  9. {
  10.     if (header.upgrade == "websocket")
  11.     {
  12.         std::cout << "Key: " << header.sec_websocket.key << std::endl;
  13.         std::cout << "Version: " << header.sec_websocket.version << std::endl;
  14.         std::cout << "Protocol:";
  15.         for (auto &protocol : header.sec_websocket.protocol)
  16.             std::cout << " " << protocol;
  17.         std::cout << std::endl;
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement