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, ...);
240 int hgethead(HConnect *c, int many);
241 int hinit(Hio*, int, int);
242 int hiserror(Hio *h);
243 int hload(Hio*, char*);
245 HContent *hmkcontent(HConnect *c, char *generic, char *specific, HContent *next);
246 HFields *hmkhfields(HConnect *c, char *s, HSPairs *p, HFields *next);
247 char *hmkmimeboundary(HConnect *c);
248 HSPairs *hmkspairs(HConnect *c, char *s, char *t, HSPairs *next);
249 int hmoved(HConnect *c, char *uri);
250 void hokheaders(HConnect *c);
251 int hparseheaders(HConnect*, int timeout);
252 HSPairs *hparsequery(HConnect *c, char *search);
253 int hparsereq(HConnect *c, int timeout);
254 int hprint(Hio*, char*, ...);
255 int hputc(Hio*, int);
256 void *hreadbuf(Hio *h, void *vsave);
257 int hredirected(HConnect *c, char *how, char *uri);
258 void hreqcleanup(HConnect *c);
259 HFields *hrevhfields(HFields *hf);
260 HSPairs *hrevspairs(HSPairs *sp);
261 char *hstrdup(HConnect *c, char *s);
262 int http11(HConnect*);
264 char *httpunesc(HConnect *c, char *s);
265 int hunallowed(HConnect *, char *allowed);
269 char *hurlunesc(HConnect *c, char *s);
270 int hwrite(Hio*, void*, int);
271 int hxferenc(Hio*, int);
274 #pragma varargck argpos hprint 2
277 * D is httpd format date conversion
278 * U is url escape convertsion
279 * H is html escape conversion
282 #pragma varargck type "D" long
283 #pragma varargck type "D" ulong
284 #pragma varargck type "U" char*
285 #pragma varargck type "H" char*
288 #if defined(__cplusplus)