| 184 | } |
| 185 | |
| 186 | static void http_upgrade(int fd) |
| 187 | { |
| 188 | u8 buf[65536]; |
| 189 | size_t len = 0; |
| 190 | |
| 191 | alarm(60); |
| 192 | while (!http_headers_complete(buf, len)) { |
| 193 | int r; |
| 194 | r = read(STDIN_FILENO, buf + len, sizeof(buf) - len); |
| 195 | if (r <= 0) |
| 196 | bad_http(STDIN_FILENO, "No header end after %zu bytes", |
| 197 | len); |
| 198 | len += r; |
| 199 | } |
| 200 | http_respond(STDIN_FILENO, buf, len); |
| 201 | alarm(0); |
| 202 | } |
| 203 | |
| 204 | static void lightningd_to_websocket(int lightningfd, int wsfd) |
| 205 | { |