HttpHeadersFind
Description
Container-callback shape of the same operation, matching GenericCopyDeinit. Plumb this into VecInitWithDeepCopy so a Vec(HttpHeader) automatically deinits each entry on removal.
Parameters
| Name | Direction | Description |
|---|---|---|
headers |
in | Caller’s Vec(HttpHeader) to search. |
key |
in | Key to look up. |
Success
Returns to the caller. *(HttpHeader *)header is zeroed. Returns a pointer to the matching header inside the vector. The pointer is valid until *headers is mutated or deinitialized.
Failure
Function cannot fail. The container guarantees header is non-NULL and a valid entry slot.
Returns NULL if no header matches; *headers is unchanged.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Http.c:29:
(ZstrCompare(next, "body-bytes") == 0);
HttpHeader *host = HttpHeadersFind(&req.headers, "Host");
ok = ok && host && ZstrCompare(StrBegin(&host->value), "example.com") == 0;
Last updated on