KHTTPDIGEST_VALIDATE(3)
π
KHTTPDIGEST_VALIDATE(3) β the libkcgi girlies' guide to validating HTTP digest requests πΈ
okay so this is a page from the Library Functions Manual, and it's about khttpdigest_validate and khttpdigest_validatehash β yes they're two functions, yes they share a page, it's giving sibling energy π.
β¨ NAME β¨
khttpdigest_validate, khttpdigest_validatehash β validate an HTTP digest request π
π LIBRARY π
she lives in the library βlibkcgiβ π
π¦ SYNOPSIS π¦
bestie, here's the exact vibe you need to include, copy it character for character:
#include <sys/types.h>
#include <stdarg.h>
#include <stdint.h>
#include <kcgi.h>
int
khttpdigest_validate(struct kreq *req, const char *password);
int
khttpdigest_validatehash(struct kreq *req, const char *hash);
π DESCRIPTION π
so the way that khttpdigest_validate() and khttpdigest_validatehash() work is they validate the given password (or a pre-combined hash) against the HTTP digest-authorised request req β and like, req has to be the one you got back from khttp_parse(3) or khttp_fcgi_parse(3), no substitutions π«Ά. It fully implements all components of the digest: QOP, MD5 types, etc. β she ate and left no crumbs π
.
β οΈ important caveat bestie: it does not check that the URI component of the digest matches that of the request, because those values are known to be mutable. so like, don't come for her about that, it's on purpose π.
The tea on the difference between the two: khttpdigest_validate() will compute a hash from the request and password, whereas khttpdigest_validatehash() operates on a pre-computed hash value π₯. same energy, different starting point, iykyk.
β RETURN VALUES β
khttpdigest_validate() and khttpdigest_validatehash() will return:
- zero β validation failed π
- less than zero β the request was not properly set up for HTTP digest validation (no HTTP method, not a digest request, not already authenticated by the web server) π
- greater than zero β validation succeeded, slay β¨π
π§ SEE ALSO π§
go read those, they're the supporting cast and they also serve π
π AUTHORS π
The khttpdigest_validate() and khttpdigest_validatehash() functions were written by Kristaps Dzonsons <kristaps@bsd.lv> β absolute main character energy, we stan π«ΆπΈ
and that's the whole page bestie, no cap π ok bye, this shipped on Debian with version $Mdocdate$ under the KHTTPDIGEST_VALIDATE(3) footer, mwah ππ
π¦ where this page comes from
- alpine 3.24: kcgi-doc 1.0.1-r0 Β· ISC
- Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms