ksgi

Форк
0
/
khtml_close.3 
103 строки · 2.7 Кб
1
.\"	$Id$
2
.\"
3
.\" Copyright (c) 2020 Kristaps Dzonsons <kristaps@bsd.lv>
4
.\"
5
.\" Permission to use, copy, modify, and distribute this software for any
6
.\" purpose with or without fee is hereby granted, provided that the above
7
.\" copyright notice and this permission notice appear in all copies.
8
.\"
9
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
.\"
17
.Dd $Mdocdate$
18
.Dt KHTML_CLOSE 3
19
.Os
20
.Sh NAME
21
.Nm khtml_close
22
.Nd close kcgihtml context
23
.Sh LIBRARY
24
.Lb libkcgihtml
25
.Sh SYNOPSIS
26
.In sys/types.h
27
.In stdarg.h
28
.In stdint.h
29
.In kcgi.h
30
.In kcgihtml.h
31
.Ft enum kcgi_err
32
.Fo khtml_close
33
.Fa "struct khtmlreq *req"
34
.Fc
35
.Sh DESCRIPTION
36
Closes
37
.Fa req ,
38
initialised with
39
.Xr khtml_open 3 .
40
All scopes opened with
41
.Xr khtml_attr 3 ,
42
.Xr khtml_attrx 3 ,
43
or
44
.Xr khtml_elem 3
45
are automatically closed.
46
After this,
47
.Fa req
48
may no longer be used.
49
.Sh RETURN VALUES
50
Returns an
51
.Ft enum kcgi_err
52
indicating the error state.
53
.Bl -tag -width -Ds
54
.It Dv KCGI_OK
55
Success (not an error).
56
.It Dv KCGI_ENOMEM
57
Internal memory allocation failure.
58
.It Dv KCGI_HUP
59
The output connection has been terminated.
60
For FastCGI connections, the current connection should be released with
61
.Xr khttp_free 3
62
and parse loop reentered.
63
.It Dv KCGI_FORM
64
The connection is still expecting headers with
65
.Xr khttp_head 3 .
66
Indicates that
67
.Xr khttp_body 3
68
did not return with success or was not invoked.
69
For FastCGI connections, the current connection should be released with
70
.Xr khttp_free 3
71
and parse loop reentered.
72
.It Dv KCGI_SYSTEM
73
Internal system error writing to the output stream.
74
.El
75
.Sh EXAMPLES
76
The following outputs a simple HTML page.
77
It assumes
78
.Va r
79
is a
80
.Vt struct kreq
81
pointer.
82
For brevity, it does not do any error checking.
83
.Bd -literal -offset indent
84
khttp_head(r, kresps[KRESP_STATUS],
85
  "%s", khttps[KHTTP_200]);
86
khttp_head(r, kresps[KRESP_CONTENT_TYPE],
87
  "%s", kmimetypes[KMIME_TEXT_HTML]);
88
khttp_body(r);
89
khtml_open(&req, r, 0);
90
khtml_elem(&req, KELEM_DOCTYPE);
91
khtml_elem(&req, KELEM_HTML);
92
khtml_elem(&req, KELEM_BODY);
93
khtml_puts(&req, "Hello, world");
94
khtml_close(&req);
95
.Ed
96
.Sh SEE ALSO
97
.Xr kcgihtml 3
98
.Sh STANDARDS
99
The referenced HTML5 standard is
100
.Lk https://www.w3.org/TR/html52 HTML5.2 .
101
.Sh AUTHORS
102
Written by
103
.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
104

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.