Mercurial
diff seobeo/s_websocket.c @ 172:0face9898d04
[PostDog] Small changes.
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Mon, 19 Jan 2026 18:56:54 -0800 |
| parents | 058de208e640 |
| children |
line wrap: on
line diff
--- a/seobeo/s_websocket.c Mon Jan 19 17:33:18 2026 -0800 +++ b/seobeo/s_websocket.c Mon Jan 19 18:56:54 2026 -0800 @@ -134,26 +134,20 @@ "Sec-WebSocket-Version: 13\r\n", p_ws->path, p_ws->host, ws_key); - // Add custom headers if provided if (headers && strlen(headers) > 0) { - // Parse newline-separated headers and convert to HTTP format const char *line_start = headers; while (*line_start) { - // Skip leading whitespace while (*line_start == ' ' || *line_start == '\t') line_start++; if (*line_start == '\0') break; - // Find end of line const char *line_end = line_start; while (*line_end && *line_end != '\n') line_end++; - // Copy line if it contains a colon (valid header) size_t line_len = line_end - line_start; if (line_len > 0 && memchr(line_start, ':', line_len) != NULL) { - // Remove trailing whitespace/CR while (line_len > 0 && (line_start[line_len-1] == '\r' || line_start[line_len-1] == ' ' || line_start[line_len-1] == '\t')) line_len--; @@ -167,12 +161,10 @@ } } - // Move to next line line_start = (*line_end == '\n') ? line_end + 1 : line_end; } } - // End headers handshake[handshake_len++] = '\r'; handshake[handshake_len++] = '\n'; handshake[handshake_len] = '\0'; @@ -238,8 +230,6 @@ return Seobeo_WebSocket_Connect_With_Headers(url, NULL); } -// Seobeo_WebSocket_Mask_Data moved to s_websocket_common.c - static int32 Seobeo_WebSocket_Send_Frame(Seobeo_WebSocket *p_ws, Seobeo_WebSocket_Opcode opcode, const uint8 *payload, size_t payload_length, boolean fin) { @@ -528,8 +518,6 @@ return p_msg; } -// Seobeo_WebSocket_Message_Destroy moved to s_websocket_common.c - int32 Seobeo_WebSocket_Close(Seobeo_WebSocket *p_ws, uint16 code, const char *reason) { if (!p_ws || p_ws->state == SEOBEO_WS_STATE_CLOSED)