GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  KHTTP_BODY (3)

NAME

khttp_body, khttp_body_compress - close the HTTP header sequence for kcgi

CONTENTS

Library
Synopsis
Description
Return Values
See Also
Authors

LIBRARY


.Lb libkcgi

SYNOPSIS


.In stdint.h
.In kcgi.h int
.Fo khttp_body struct kreq *req
.Fc int
.Fo khttp_body_compress struct kreq *req int compress
.Fc

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 argument 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 appropriate "Content-Encoding" header and try to enable write compression. 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 compression.
<0 Simply open the document body: do not fiddle with compression at all. This is useful if the application will have complete control 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
.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
Search for    or go to Top of page |  Section 3 |  Main Index


Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.