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

Function main

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

Source from the content-addressed store, hash-verified

146/* AUTOGENERATED MOCKS END */
147
148int main(int argc, char *argv[])
149{
150 const char *hdr;
151
152 common_setup(argv[0]);
153
154 hdr = "GET /chat HTTP/1.1\r\n"
155 "Host: server.example.com\r\n"
156 "Upgrade: websocket\r\n"
157 "Connection: Upgrade\r\n"
158 "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n"
159 "Origin: http://example.com\r\n"
160 "Sec-WebSocket-Protocol: chat, superchat\r\n"
161 "Sec-WebSocket-Version: 13\r\n\r\n";
162
163 my_rbuf = tal_strdup(tmpctx, hdr);
164 my_wbuf = tal_arr(tmpctx, char, 0);
165
166 http_upgrade(STDIN_FILENO);
167 assert(streq(tal_strndup(tmpctx, my_wbuf, tal_bytelen(my_wbuf)),
168 "HTTP/1.1 101 Switching Protocols\r\n"
169 "Upgrade: websocket\r\n"
170 "Connection: Upgrade\r\n"
171 "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n"
172 "\r\n"));
173
174 common_shutdown();
175}

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