3 #if defined(__cplusplus)
9 #pragma lib "libhttpd.a"
10 #pragma src "/sys/src/libhttpd"
13 typedef struct HConnect HConnect;
14 typedef struct HContent HContent;
15 typedef struct HContents HContents;
16 typedef struct HETag HETag;
17 typedef struct HFields HFields;
18 typedef struct Hio Hio;
19 typedef struct Htmlesc Htmlesc;
20 typedef struct HttpHead HttpHead;
21 typedef struct HttpReq HttpReq;
22 typedef struct HRange HRange;
23 typedef struct HSPairs HSPairs;
26 typedef struct Bin Bin;
55 * table of html character escape codes
68 float q; /* desirability of this kind of file */
69 int mxb; /* max uchars until worthless */
79 * generic http header with a list of tokens,
80 * each with an optional list of parameters
90 * list of pairs a strings
91 * used for tag=val pairs for a search or form submission,
92 * and attribute=value pairs in headers.
102 * byte ranges within a file
106 int suffix; /* is this a suffix request? */
108 ulong stop; /* ~0UL -> not given */
113 * list of http/1.1 entity tags
124 * supports chunked transfer encoding
125 * and initialization of the input buffer from a string.
139 Hio *hh; /* next lower layer Hio, or nil if reads from fd */
140 int fd; /* associated file descriptor */
141 ulong seek; /* of start */
142 uchar state; /* state of the file */
143 uchar xferenc; /* chunked transfer encoding state */
144 uchar *pos; /* current position in the buffer */
145 uchar *stop; /* last character active in the buffer */
146 uchar *start; /* start of data buffer */
147 ulong bodylen; /* remaining length of message body */
162 HSPairs *searchpairs;
170 int closeit; /* http1.1 close connection after this request? */
171 uchar persist; /* http/1.1 requests a persistent connection */
173 uchar expectcont; /* expect a 100-continue */
174 uchar expectother; /* expect anything else; should reject with ExpectFail */
175 ulong contlen; /* if != ~0UL, length of included message body */
176 HFields *transenc; /* if present, encoding of included message body */
190 char *authuser; /* authorization info */
194 * experimental headers
201 * all of the state for a particular connection
205 void *private; /* for the library clients */
206 void (*replog)(HConnect*, char*, ...); /* called when reply sent */
213 ulong reqtime; /* time at start of request */
214 char xferbuf[HBufSize]; /* buffer for making up or transferring data */
215 uchar header[HBufSize + 2]; /* room for \n\0 */
223 * configuration for all connections within the server
225 extern char* hmydomain;
226 extern char* hversion;
227 extern Htmlesc htmlesc[];
230 * .+2,/^$/ | sort -bd +1
232 void *halloc(HConnect *c, ulong size);
233 Hio *hbodypush(Hio *hh, ulong len, HFields *te);
234 int hbuflen(Hio *h, void *p);
235 int hcheckcontent(HContent*, HContent*, char*, int);
237 ulong hdate2sec(char*);
239 int hfail(HConnect*, int, ...);
243 int hgethead(HConnect *c, int many);
244 int hinit(Hio*, int, int);
245 int hiserror(Hio *h);
246 int hload(Hio*, char*);
248 HContent *hmkcontent(HConnect *c, char *generic, char *specific, HContent *next);
249 HFields *hmkhfields(HConnect *c, char *s, HSPairs *p, HFields *next);
250 char *hmkmimeboundary(HConnect *c);
251 HSPairs *hmkspairs(HConnect *c, char *s, char *t, HSPairs *next);
252 int hmoved(HConnect *c, char *uri);
253 void hokheaders(HConnect *c);
254 int hparseheaders(HConnect*, int timeout);
255 HSPairs *hparsequery(HConnect *c, char *search);
256 int hparsereq(HConnect *c, int timeout);
257 int hprint(Hio*, char*, ...);
258 int hputc(Hio*, int);
259 void *hreadbuf(Hio *h, void *vsave);
260 int hredirected(HConnect *c, char *how, char *uri);
261 void hreqcleanup(HConnect *c);
262 HFields *hrevhfields(HFields *hf);
263 HSPairs *hrevspairs(HSPairs *sp);
264 char *hstrdup(HConnect *c, char *s);
265 int http11(HConnect*);
267 char *httpunesc(HConnect *c, char *s);
268 int hunallowed(HConnect *, char *allowed);
272 char *hurlunesc(HConnect *c, char *s);
273 int hwrite(Hio*, void*, int);
274 int hxferenc(Hio*, int);
277 #pragma varargck argpos hprint 2
280 * D is httpd format date conversion
281 * U is url escape convertsion
282 * H is html escape conversion
285 #pragma varargck type "D" long
286 #pragma varargck type "D" ulong
287 #pragma varargck type "U" char*
288 #pragma varargck type "H" char*
291 #if defined(__cplusplus)