3 #if defined(__cplusplus)
7 #pragma lib "libhttpd.a"
8 #pragma src "/sys/src/libhttpd"
11 typedef struct HConnect HConnect;
12 typedef struct HContent HContent;
13 typedef struct HContents HContents;
14 typedef struct HETag HETag;
15 typedef struct HFields HFields;
16 typedef struct Hio Hio;
17 typedef struct Htmlesc Htmlesc;
18 typedef struct HttpHead HttpHead;
19 typedef struct HttpReq HttpReq;
20 typedef struct HRange HRange;
21 typedef struct HSPairs HSPairs;
24 typedef struct Bin Bin;
53 * table of html character escape codes
66 float q; /* desirability of this kind of file */
67 int mxb; /* max uchars until worthless */
77 * generic http header with a list of tokens,
78 * each with an optional list of parameters
88 * list of pairs a strings
89 * used for tag=val pairs for a search or form submission,
90 * and attribute=value pairs in headers.
100 * byte ranges within a file
104 int suffix; /* is this a suffix request? */
106 ulong stop; /* ~0UL -> not given */
111 * list of http/1.1 entity tags
122 * supports chunked transfer encoding
123 * and initialization of the input buffer from a string.
137 Hio *hh; /* next lower layer Hio, or nil if reads from fd */
138 int fd; /* associated file descriptor */
139 ulong seek; /* of start */
140 uchar state; /* state of the file */
141 uchar xferenc; /* chunked transfer encoding state */
142 uchar *pos; /* current position in the buffer */
143 uchar *stop; /* last character active in the buffer */
144 uchar *start; /* start of data buffer */
145 ulong bodylen; /* remaining length of message body */
167 int closeit; /* http1.1 close connection after this request? */
168 uchar persist; /* http/1.1 requests a persistent connection */
170 uchar expectcont; /* expect a 100-continue */
171 uchar expectother; /* expect anything else; should reject with ExpectFail */
172 ulong contlen; /* if != ~0UL, length of included message body */
173 HFields *transenc; /* if present, encoding of included message body */
187 char *authuser; /* authorization info */
191 * experimental headers
198 * all of the state for a particular connection
202 void *private; /* for the library clients */
203 void (*replog)(HConnect*, char*, ...); /* called when reply sent */
210 ulong reqtime; /* time at start of request */
211 char xferbuf[HBufSize]; /* buffer for making up or transferring data */
212 uchar header[HBufSize + 2]; /* room for \n\0 */
220 * configuration for all connections within the server
222 extern char* hmydomain;
223 extern char* hversion;
224 extern Htmlesc htmlesc[];
227 * .+2,/^$/ | sort -bd +1
229 void *halloc(HConnect *c, ulong size);
230 Hio *hbodypush(Hio *hh, ulong len, HFields *te);
231 int hbuflen(Hio *h, void *p);
232 int hcheckcontent(HContent*, HContent*, char*, int);
234 ulong hdate2sec(char*);
236 int hfail(HConnect*, int, ...);
239 int hgethead(HConnect *c, int many);
240 int hinit(Hio*, int, int);
241 int hiserror(Hio *h);
242 int hload(Hio*, char*);
244 HContent *hmkcontent(HConnect *c, char *generic, char *specific, HContent *next);
245 HFields *hmkhfields(HConnect *c, char *s, HSPairs *p, HFields *next);
246 char *hmkmimeboundary(HConnect *c);
247 HSPairs *hmkspairs(HConnect *c, char *s, char *t, HSPairs *next);
248 int hmoved(HConnect *c, char *uri);
249 void hokheaders(HConnect *c);
250 int hparseheaders(HConnect*, int timeout);
251 HSPairs *hparsequery(HConnect *c, char *search);
252 int hparsereq(HConnect *c, int timeout);
253 int hprint(Hio*, char*, ...);
254 int hputc(Hio*, int);
255 void *hreadbuf(Hio *h, void *vsave);
256 int hredirected(HConnect *c, char *how, char *uri);
257 void hreqcleanup(HConnect *c);
258 HFields *hrevhfields(HFields *hf);
259 HSPairs *hrevspairs(HSPairs *sp);
260 char *hstrdup(HConnect *c, char *s);
261 int http11(HConnect*);
263 char *httpunesc(HConnect *c, char *s);
264 int hunallowed(HConnect *, char *allowed);
268 char *hurlunesc(HConnect *c, char *s);
269 int hwrite(Hio*, void*, int);
270 int hxferenc(Hio*, int);
273 #pragma varargck argpos hprint 2
276 * D is httpd format date conversion
277 * U is url escape convertsion
278 * H is html escape conversion
281 #pragma varargck type "D" long
282 #pragma varargck type "D" ulong
283 #pragma varargck type "U" char*
284 #pragma varargck type "H" char*
287 #if defined(__cplusplus)