| 1 | #include "stdafx.h" |
| 2 | |
| 3 | static bool handshake(acl::socket_stream& conn) |
| 4 | { |
| 5 | acl::http_request req(&conn); |
| 6 | acl::http_header& hdr = req.request_header(); |
| 7 | hdr.set_ws_key("123456789") |
| 8 | .set_ws_version(13) |
| 9 | .set_upgrade("websocket") |
| 10 | .set_keep_alive(true); |
| 11 | |
| 12 | if (!req.request(NULL, 0)) { |
| 13 | printf("request error\r\n"); |
| 14 | return false; |
| 15 | } |
| 16 | |
| 17 | int status = req.http_status(); |
| 18 | if (status != 101) { |
| 19 | printf("invalid http status: %d\r\n", status); |
| 20 | return false; |
| 21 | } |
| 22 | |
| 23 | return true; |
| 24 | } |
| 25 | |
| 26 | static bool send_file(acl::websocket& ws, const char* filepath) |
| 27 | { |
no test coverage detected
searching dependent graphs…