Mercurial
diff seobeo/s_web.c @ 264:04fee26ecce0
add authenticated JRPG conversation platform
Add reusable auth/session storage, owned conversation recovery, guest quotas, admin workflows, URL-routed conversation UI, mobile frame support, and parallel browser acceptance.
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Fri, 07 Aug 2026 07:34:12 -0700 |
| parents | 1f9877b637e9 |
| children |
line wrap: on
line diff
--- a/seobeo/s_web.c Thu Aug 06 11:31:30 2026 -0700 +++ b/seobeo/s_web.c Fri Aug 07 07:34:12 2026 -0700 @@ -42,6 +42,9 @@ if (strcasecmp(header, "content-type") == 0) return "Content-Type"; if (strcasecmp(header, "connection") == 0) return "Connection"; if (strcasecmp(header, "authorization") == 0) return "Authorization"; + if (strcasecmp(header, "cookie") == 0) return "Cookie"; + if (strcasecmp(header, "origin") == 0) return "Origin"; + if (strcasecmp(header, "x-csrf-token") == 0) return "X-CSRF-Token"; if (strcasecmp(header, "host") == 0) return "Host"; if (strcasecmp(header, "upgrade") == 0) return "Upgrade"; if (strcasecmp(header, "x-real-ip") == 0) return "X-Real-IP"; @@ -204,11 +207,6 @@ void *p_conn_kv = Dowa_HashMap_Get_Ptr(p_req_map, "Connection"); const char *conn_header = p_conn_kv ? ((Seobeo_Request_Entry*)p_conn_kv)->value : NULL; - void *p_real_ip_kv = Dowa_HashMap_Get_Ptr(p_req_map, "X-Real-IP"); - const char *real_ip = p_real_ip_kv ? ((Seobeo_Request_Entry*)p_real_ip_kv)->value : NULL; - if (!real_ip) - real_ip = p_cli_handle->host; - if (conn_header) { if (connection_header_contains(conn_header, "close")) @@ -449,11 +447,10 @@ // This seems kinda bad ? char method[16], path[256], version[16]; int scan_result = sscanf(buf, "%15s %255s %15s", method, path, version); - Seobeo_Log(SEOBEO_DEBUG, "sscanf returned %d (method='%s', path='%s', version='%s')\n", + Seobeo_Log(SEOBEO_DEBUG, "sscanf returned %d (method='%s', path_length=%zu)\n", scan_result, scan_result >= 1 ? method : "N/A", - scan_result >= 2 ? path : "N/A", - scan_result >= 3 ? version : "N/A"); + scan_result >= 2 ? strlen(path) : (size_t)0); if (scan_result != 3) { @@ -474,6 +471,14 @@ Seobeo_Log(SEOBEO_DEBUG, "Pushing HTTP_Method and Version to map\n"); Dowa_HashMap_Push_Arena(*pp_map, "HTTP_Method", method_copy, p_arena); Dowa_HashMap_Push_Arena(*pp_map, "Version", version_copy, p_arena); + if (p_handle->host) + { + char *remote_addr = Dowa_Arena_Allocate(p_arena, strlen(p_handle->host) + 1); + if (!remote_addr) + return -1; + strcpy(remote_addr, p_handle->host); + Dowa_HashMap_Push_Arena(*pp_map, "Remote-Addr", remote_addr, p_arena); + } Seobeo_Log(SEOBEO_DEBUG, "Map now has %zu entries\n", Dowa_Array_Length(*pp_map)); char *raw_path = path; @@ -563,6 +568,12 @@ memcpy(key, line, key_len); key[key_len] = '\0'; + if (strcasecmp(key, "remote-addr") == 0) + { + line = next + 2; + continue; + } + char *val = Dowa_Arena_Allocate(p_arena, value_len + 1); if (!val) return -1; memcpy(val, val_start, value_len);