xref: /plan9/sys/src/cmd/ip/httpd/httpsrv.h (revision b39189fd423aed869c5cf5189bc504918cff969b)
1 typedef struct HSPriv	HSPriv;
2 
3 enum
4 {
5 	HSTIMEOUT	= 15 * 60 * 1000,
6 
7 	/* rewrite replacement field modifiers */
8 	Modsilent	= '@',	/* don't tell the browser about the redirect. */
9 	Modperm		= '=',	/* generate permanent redirection */
10 	Modsubord	= '*',	/* map page & all subordinates to same URL */
11 	Modonly		= '>',	/* match only this page, not subordinates */
12 
13 	Redirsilent	= 1<<0,
14 	Redirperm	= 1<<1,
15 	Redirsubord	= 1<<2,
16 	Redironly	= 1<<3,
17 };
18 
19 struct HSPriv
20 {
21 	char		*remotesys;
22 	char		*remoteserv;
23 };
24 
25 extern	int		logall[3];
26 extern	char*		HTTPLOG;
27 extern	char*		webroot;
28 extern	char*		netdir;
29 
30 #define 		STRLEN(s)	(sizeof(s)-1)
31 
32 /* emem.c */
33 char			*estrdup(char*);
34 void*			ezalloc(ulong);
35 
36 /* sendfd.c */
37 int			authcheck(HConnect *c);
38 int			checkreq(HConnect *c, HContent *type, HContent *enc, long mtime, char *etag);
39 int			etagmatch(int, HETag*, char*);
40 HRange			*fixrange(HRange *h, long length);
41 int			sendfd(HConnect *c, int fd, Dir *dir, HContent *type, HContent *enc);
42 
43 /* content.c */
44 void			contentinit(void);
45 HContents		dataclass(HConnect *, char*, int);
46 int			updateQid(int, Qid*);
47 HContents		uriclass(HConnect *, char*);
48 
49 /* anonymous.c */
50 void			anonymous(HConnect*);
51 
52 /* hint.c */
53 void			hintprint(HConnect *hc, Hio*, char *, int, int);
54 void			statsinit(void);
55 void			urlcanon(char *url);
56 void			urlinit(void);
57 
58 /* init.c */
59 HConnect*		init(int, char**);
60 
61 vlong			Bfilelen(void*);
62 
63 /* redirect.c */
64 void			redirectinit(void);
65 char*			redirect(HConnect *hc, char*, uint *);
66 char*			masquerade(char*);
67 char*			authrealm(HConnect *hc, char *path);
68 char			*undecorated(char *repl);
69 
70 /* log.c */
71 void			logit(HConnect*, char*, ...);
72 #pragma	varargck	argpos	logit	2
73 void			writelog(HConnect*, char*, ...);
74 #pragma	varargck	argpos	writelog	2
75 
76 /* authorize.c */
77 int authorize(HConnect*, char*);
78 
79 char *webroot;
80