3 httpd, save, imagemap, man2html, webls \- HTTP server
45 directory of the file system described by
48 .BR /lib/namespace.httpd ),
49 using version 1.1 of the HTTP protocol.
50 It announces the service
54 and listens for incoming calls.
55 If an X.509 certificate is supplied with the
57 option, then the service is instead
59 There should already be a factotum
60 holding the corresponding private key.
61 If the specified certificate has been signed
62 by a certificate authority, the
64 option may be used to specify a file
65 containing a chain of signed certificates.
68 supports only the GET and HEAD methods of the HTTP protocol;
69 some magic programs support POST as well.
70 Persistent connections are supported for HTTP/1.1 or later clients;
71 all connections close after a magic command is executed.
74 .BR application/octet-stream )
78 of a file are determined by looking for suffixes of the file name in
79 .BR /sys/lib/mimetype .
82 Each requested URI is looked up in a redirection table, read from
83 .BR /sys/lib/httpd.rewrite .
84 Fields are separated by spaces and tabs.
88 The first field of each line is a URI;
89 the second a replacement path.
90 If a prefix of the URI matches a redirection path,
91 the URI is rewritten using the corresponding replacement path
92 instead of the prefix,
93 and a temporary redirect is sent to the HTTP client.
94 If the replacement path does not specify a server name,
95 and the request has no explicit host,
98 is the host name used in the redirection.
99 The prefix can either be a domain root like
101 (which matches that URL only)
104 (which matches that path no matter what
105 the requested server),
107 .B http://system/who/rob
108 will never match a request.
109 If the first field ends in a slash, this is an exact match;
110 otherwise it is a prefix match.
111 The first field is a literal string, matched against
112 each file prefix of each URL.
113 The most specific, i.e., longest,
114 pattern wins, and is applied once (there is no rescanning),
115 except for the following exceptions.
117 matches only the prefix and not subordinate pages
118 if a replacement is prefixed with
121 omits the unmatched part of the original URI
122 from the rewritten URI if the replacement is prefixed with
124 This permits many-to-one mappings; for example,
125 to send all references to an old subtree to a single error page.
128 handles replacements prefixed with
131 treating the request as if it were for the replacement
134 but not informing the client of the rewritten name.
135 Replacement URLs prefixed with
137 generate a permanent redirection instead of a temporary one.
139 checks to see if this file has changed once every 50 new TCP connections.
140 HTTP 1.1 persistent connection implies many pages
141 may come in one browser connection, so to kick-start
146 for(i in `{seq 50}) hget http://www.your-domain.com/ >/dev/null
150 Before opening any file,
152 looks for a file in the same directory called
154 If the file exists, the directory is considered
155 locked and the client must specify a user name
156 and password matching a pair in the file.
158 contains a list of space or newline separated tokens, each
159 possibly delimited by single quotes. The first
160 is a domain name presented to the HTTP client.
161 The rest are pairs of user name and password.
162 Thus, there can be many user name/password pairs
163 valid for a directory.
166 .SS "Auxiliaries (magic)"
168 If the requested URI begins with
169 .BI /magic/ server /\f1,
172 .BI /bin/ip/httpd/ server
173 to finish servicing the request.
174 All the auxiliaries take the same arguments.
178 are those received on the first line of the request.
180 is the remaining portion of the requested URI.
182 contains the rest of the bytes read by the server,
185 is the network directory for the connection.
186 There are routines for processing command arguments,
187 parsing headers, etc. in the httpd library,
188 .BR /sys/src/cmd/ip/httpd/libhttpd.a.$O .
191 in that directory and existing magic commands for more details.
195 .BI /usr/web/save/ uri .data
196 and returns the contents of
197 .BI /usr/web/save/ uri .html.
198 Both files must be accessible for the request to succeed.
199 The saved line includes the current time
200 and either the search string from a HEAD or GET
201 or the first line of the body from a POST.
202 It is used to record form submissions.
205 processes an HTML imagemap query.
206 It looks up the point
208 in the image map file given by
210 and returns a redirection to the appropriate page.
211 The map file defaults to NCSA format.
212 Any entries after a line starting with the word
214 are interpreted in CERN format.
219 format manual pages into html.
220 It includes some abilities to search the manuals.
223 produces directory listings on the fly, with
224 output in the style of
226 .B /sys/lib/webls.allowed
228 .B /sys/lib/webls.denied
229 contain regular expressions describing
232 namespace may and may not be listed, respectively.
234 is first searched to see if access is by default
237 is then searched to see if access is explicitly allowed.
238 Thus one can have very general expressions in the
241 yet still allow exceptions. If
243 does not exist or is unreadable,
244 all accesses are assumed to be denied unless
245 explicitly allowed in
248 Other sites will note that if neither
252 exist, any portion of
254 namespace can be listed (however,
256 will always endeavor to prevent listing of `.' and `..').
261 does not, any directory to be listed must be described
262 by a regular expression in
268 does not, any directory to be listed must
270 be described by a regular expression in
272 If both exist, a directory is listable if either
275 or it appears in both
283 If a listing for a directory is requested and access
284 is denied, or another error occurs, a simple error
287 These are all examples of how to use
293 /netlib/c++/idioms/index.html.Z /netlib/c++/idioms/index.html
297 Redirection to another site:
300 /netlib/lapack/lawns =http://netlib.org/lapack/lawns
301 http://inferno.bell-labs.com =http://www.vitanuova.com
305 Root directory for virtual host:
308 http://www.ampl.com /cm/cs/what/ampl
312 .TF /sys/lib/httpd.rewrite
315 content type description file
317 .B /lib/namespace.httpd
318 default namespace file for httpd
320 .B /sys/lib/httpd.rewrite
323 .B /sys/lib/webls.allowed
324 regular expressions describing explicitly listable pathnames; overrides
327 .B /sys/lib/webls.denied
328 regular expressions describing explicitly unlistable pathnames
330 .B /sys/src/cmd/ip/httpd