MCPcopy Create free account
hub / github.com/ElementsProject/lightning / main

Function main

connectd/test/run-websocket.c:54–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52/* AUTOGENERATED MOCKS END */
53
54int main(int argc, char *argv[])
55{
56 const char *hdr;
57
58 common_setup(argv[0]);
59
60 hdr = "GET /chat HTTP/1.1\r\n"
61 "Host: server.example.com\r\n"
62 "Upgrade: websocket\r\n"
63 "Connection: Upgrade\r\n"
64 "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n"
65 "Origin: http://example.com\r\n"
66 "Sec-WebSocket-Protocol: chat, superchat\r\n"
67 "Sec-WebSocket-Version: 13\r\n\r\n";
68
69 my_rbuf = tal_strdup(tmpctx, hdr);
70 my_wbuf = tal_arr(tmpctx, char, 0);
71
72 http_upgrade(STDIN_FILENO);
73 assert(streq(tal_strndup(tmpctx, my_wbuf, tal_bytelen(my_wbuf)),
74 "HTTP/1.1 101 Switching Protocols\r\n"
75 "Upgrade: websocket\r\n"
76 "Connection: Upgrade\r\n"
77 "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n"
78 "\r\n"));
79
80 common_shutdown();
81}

Callers

nothing calls this directly

Calls 4

common_setupFunction · 0.85
http_upgradeFunction · 0.85
tal_bytelenFunction · 0.85
common_shutdownFunction · 0.85

Tested by

no test coverage detected