summary refs log tree commit diff
path: root/man/libhttpc_loadrequest.3
blob: b25e09dd5345a81433f21973aab8ae4c672a2538 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
.Dd December 15, 2024
.Dt LIBHTTPC_LOADREQUEST 3
.Os
.
.Sh NAME
.Nm LibHTTPC_loadRequest ,
.Nm LibHTTPC_readRequest
.Nd parse HTTP request
.
.Sh SYNOPSIS
.In libhttpc/libhttpc.h
.Ft "struct LibHTTPC_Request *"
.Fo LibHTTPC_loadRequest
.Fa "struct LibHTTPC_Request *request_buf"
.Fa "char *buf"
.Fc
.Ft "struct LibHTTPC_Request *"
.Fo LibHTTPC_readRequest
.Fa "int sockfd"
.Fa "struct LibHTTPC_Request *request_buf"
.Fa "char *buf"
.Fa "size_t buf_len"
.Fc
.
.Sh DESCRIPTION
.Fn LibHTTPC_loadRequest
parses
.Fa buf
and fills
.Fa request_buf .
.
.Pp
.Fn LibHTTPC_readRequest
parses
.Xr libhttpc_request 3
from
.Xr socket 2
directly.
.Fa buf
can't be NULL.
Behavior
for this should be
implemented later,
though.
.
.Pp
If
.Fa request_buf
is
.Dv NULL ,
then function will
allocate buffer
itself.
.
.Sh RETURN VALUES
.Fn LibHTTPC_loadRequest
returns pointer to
.Fa request_buf
on success,
or
.Dv NULL
on error.
.
.Pp
If
.Fn LibHTTPC_loadRequest
returned
.Dv NULL ,
it could mean
either:
.Bl -bullet
.It
If
.Xr errno 3
is 0
(Success),
it means
that user
hadn't set
.Xr libhttpc-alloc 3 .
.It
If
.Xr errno 3
is not 0,
it means
that some allocation function
has failed.
Read
.Ql ERRORS
section of
.Xr malloc 3
for more information.
.El
.
.Pp
If
.Fn LibHTTPC_readRequest
returned
.Dv NULL ,
it could mean
either:
.Bl -bullet
.It
If
.Xr errno 3
is 0
(Success),
then either:
.Bl -bullet
.It
Either
.Fa buf
is
.Dv NULL
or
.Fa buf_len
is 0
.It
Read text about
return values of
.Fn LibHTTPC_loadRequest
.El
.It
If
.Xr errno 3
is not 0,
it means that either:
.Bl -bullet
.It
.Xr recv 2
has failed.
Read
.Ql ERRORS
section of
.Xr recv 2
for more information.
.It
Read text about
return values of
.Fn LibHTTPC_loadRequest
.El
.El
.
.Sh SEE ALSO
.Xr libhttpc 3 ,
.Xr libhttpc-alloc 3 ,
.Xr libhttpc_header 3 ,
.Xr libhttpc_request 3
.
.Sh AUTHORS
.An Nakidai Perumenei Aq Mt nakidai@disroot.org
.
.Sh CAVEATS
.Fn LibHTTPC_loadRequest
function will
destroy the buffer
while working.
It sets
0 char
on the end
of every string in
.Fa request_buf .
Note that
.Fn LibHTTPC_readRequest
uses
.Fn LibHTTPC_loadRequest
under the hood.