W7 done done

This commit is contained in:
root
2026-06-15 11:06:35 +00:00
parent 1743c51e46
commit abcb66717e
14 changed files with 207 additions and 1 deletions
+29
View File
@@ -0,0 +1,29 @@
:sig
StringMap split_http_headers(String s)
:params
s : HTTP request or header text
return value : parsed request/header fields
:see
>string
split_kv
parse_query
0_Request
:content
Parses HTTP request/header text into a `StringMap`.
For a request line, the returned map includes fields such as `REQUEST_METHOD`, `REQUEST_URI`, `SCRIPT_NAME`, `QUERY_STRING`, and `SERVER_PROTOCOL`. Header names are normalized to uppercase CGI-style keys, for example `Host` becomes `HTTP_HOST`.
Example:
```uce
StringMap h = split_http_headers("GET /demo.uce?x=1 HTTP/1.1\r\nHost: example.test\r\n\r\n");
// h["REQUEST_METHOD"] == "GET"
// h["SCRIPT_NAME"] == "/demo.uce"
// h["QUERY_STRING"] == "x=1"
// h["HTTP_HOST"] == "example.test"
```
Most page code should read `context.params` instead. Use this helper when parsing raw HTTP text in tests or protocol helpers.