khttp_body man page on DragonFly

Man page or keyword search:  
man Server   44335 pages
apropos Keyword Search (all sections)
Output format
DragonFly logo
[printable version]

KHTTP_BODY(3)		 BSD Library Functions Manual		 KHTTP_BODY(3)

NAME
     khttp_body, khttp_body_compress — close the HTTP header sequence for kcgi

LIBRARY
     library “libkcgi”

SYNOPSIS
     #include <stdint.h>
     #include <kcgi.h>

     int
     khttp_body(struct kreq *req);

     int
     khttp_body_compress(struct kreq *req, int compress);

DESCRIPTION
     The khttp_body and khttp_body_compress functions terminate the zero or
     more khttp_head(3) calls for a kcgi(3) context.  After these functions,
     invoking khttp_head(3) will result in undefined behaviour.

     khttp_body_compress takes an additional argument, compress, that dictates
     whether compression should be enabled.  If khttp_body is used, this argu‐
     ment is set as 1.	The values for compress are as follows:

     >0	     Check whether the “Accept-Encoding” request header specified
	     “gzip” with a non-zero or empty q-value.  If so, emit the appro‐
	     priate “Content-Encoding” header and try to enable write compres‐
	     sion.  This auto-compression setting is the default behaviour of
	     khttp_body.

     0	     Do not check for the request header and do not emit
	     “Content-Encoding”, but try to enable write compression anyway.
	     This is useful for applications overriding the “Content-Encoding”
	     header themselves and want to explicitly stipulate output com‐
	     pression.

     <0	     Simply open the document body: do not fiddle with compression at
	     all.  This is useful if the application will have complete con‐
	     trol over the output stream.  Calls to khttp_write(3) will be
	     uncompressed.

     If kcgi(3) is not built with zlib(3) support, compression is never
     enabled regardless the argument to khttp_body_compress().	If zlib(3)
     fails when enabling compression, the error is reported and compression is
     disabled.

RETURN VALUES
     Both functions will return zero if compression was not enabled and non-
     zero if it was.  Enabling means only that subsequent calls to
     khttp_write(3) and family will be compressed, not whether the compression
     “Content-Encoding” header was emitted.

SEE ALSO
     kcgi(3), khttp_head(3), zlib(3)

AUTHORS
     The khttp_body function was written by Kristaps Dzonsons
     ⟨kristaps@bsd.lv⟩.

BSD				April 29, 2024				   BSD
[top]

List of man pages available for DragonFly

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net