DragonFly On-Line Manual Pages

Search: Section:  


KHTTP_HEAD(3)         DragonFly Library Functions Manual         KHTTP_HEAD(3)

NAME

khttp_head - emit HTTP headers for kcgi

LIBRARY

library "libkcgi"

SYNOPSIS

#include <stdint.h> #include <kcgi.h> void khttp_head(struct kreq *req, const char *key, const char *fmt, ...);

DESCRIPTION

The khttp_head function emits HTTP headers for a kcgi(3) context allocated by khttp_parse(3). This may only be invoked prior to khttp_body(3); if not, its behaviour is undefined. The key value should be an HTTP response pair key. The fmt string and variable arguments, which follow printf(3) syntax, should be the HTTP response pair value. The kresps global array, defined in khttp_parse(3), provides indexed HTTP response keys for the default enum kresp. Use it! See khttp_body(3) for a discussion on the "Content-Encoding" header: do not specify this header before doing so!

EXAMPLES

To emit a session cookie (no expiration date) with key "foo" and value "bar" for the global path, one may invoke the following. Assume that r is a context allocated by khttp_parse(3). khttp_head(r, kresps[KRESP_SET_COOKIE], "%s", "foo=bar; path=/");

SEE ALSO

kcgi(3), khttp_body(3), khttp_parse(3)

AUTHORS

The khttp_head function was written by Kristaps Dzonsons <kristaps@bsd.lv>.

CAVEATS

Long header values (>= 1024 B) will be truncated. DragonFly 6.5-DEVELOPMENT January 4, 2016 DragonFly 6.5-DEVELOPMENT

Search: Section: