httpd/parse
src/httpd/parse.tur
HTTP/1.1 request parser.
Since: H2
defn
parse-request
(parse-request [buf : cstr len : int] :)
parse a raw HTTP/1.1 request buffer into a Request handle.
Parameters
| buf | :cstr pointer to the raw request bytes (may contain NULs in the | |
| body, but the request line + headers must be ASCII). Caller | ||
| retains ownership of buf. | ||
| len | :int length of buf in bytes. |
Returns
:int -- opaque Request handle, or 0 if the request is malformed (no request line, no CRLF CRLF terminator, etc.). Free with free-request.
Example
(let [req (parse-request raw-bytes raw-len)]
(when (not= req 0)
;; ... use httpd/request accessors ...
(free-request req)))
Since: H2
defn
free-request
(free-request [req : int] :)
release a Request handle returned by parse-request.
Parameters
| req | :int handle from parse-request, or 0 (no-op). |
Returns
:void
Example
(free-request req)
Since: H2