MCPcopy Create free account
hub / github.com/acl-dev/acl / handshake

Function handshake

lib_acl_cpp/samples/websocket/upload_client/main.cpp:3–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include "stdafx.h"
2
3static 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
26static bool send_file(acl::websocket& ws, const char* filepath)
27{

Callers 4

uploadFunction · 0.85
openMethod · 0.85
openMethod · 0.85
openMethod · 0.85

Calls 4

request_headerMethod · 0.80
set_keep_aliveMethod · 0.80
http_statusMethod · 0.80
requestMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…