• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

cgi/H10-Jun-2004-3620

mk/H10-Jun-2004-288179

ssl/H10-Jun-2004-146139

COPYINGH A D08-Jun-200417.6 KiB341281

GNUmakefileH A D03-May-20221.7 KiB9058

INSTALLH A D08-Jun-20041.7 KiB6039

READMEH A D10-Jun-20049.2 KiB359243

VERSIONH A D08-Jun-20045 21

cgi.cH A D08-Jun-20046 KiB258208

httpd.hH A D10-Jun-20047 KiB258198

ls.cH A D03-May-202211.6 KiB505418

mime.cH A D08-Jun-20041.5 KiB7966

request.cH A D10-Jun-200414.5 KiB629518

response.cH A D03-May-202214.5 KiB561480

ssl.cH A D08-Jun-20043.2 KiB156131

webfs.specH A D10-Jun-2004870 4033

webfsd.cH A D10-Jun-200423.8 KiB1,015897

webfsd.manH A D03-May-20225.3 KiB166165

README

1
2This is a simple http server for pure static content.  You
3can use it to serve the content of a ftp server via http for
4example.  It is also nice to export some files the quick way
5by starting a http server in a few seconds, without editing
6some config file first.
7
8It uses sendfile() and knows how to use sendfile on linux and FreeBSD.
9Adding other systems shouldn't be difficult.  To use it with linux
10you'll need a 2.2.x kernel and glibc 2.1.
11
12There is some sendfile emulation code which uses a userland bounce
13buffer, this allows to compile and use webfs on systems without
14sendfile().
15
16
17Features/Design:
18================
19
20 * single process: select() + non-blocking I/O.
21 * trimmed to use as few system calls as possible per request.
22 * use sendfile to avoid copying data to userspace.
23 * optional thread support.  Every thread has its own select
24   loop then (compile time option, off by default, edit the
25   Makefile to turn it on).
26 * automatically generates directory listings when asked for a
27   directory (check for index.html available as option), caches
28   the listings.
29 * no config file, just a few switches.  Try "webfsd -h" for a
30   list, check the man page for a more indepth description.
31 * Uses /etc/mime.types to map file extentions to mime/types.
32 * Uses normal unix access rights, it will deliver every regular
33   file it is able to open for reading.  If you want it to serve
34   public-readable files only, make sure it runs as nobody/nogroup.
35 * supports keep-alive and pipelined requests.
36 * serves byte ranges.
37 * supports virtual hosts.
38 * supports ipv6.
39 * optional logging in common log file format.
40 * optional error logging (to syslog / stderr).
41 * limited CGI support (GET requests only).
42 * optional SSL support.
43
44
45Plans/BUGS/TODO
46===============
47
48 * figure out why the acroread plugin doesn't like my
49   multipart/byteranges responses.
50 * benchmarking / profiling.
51
52Don't expect much more features.  I want to keep it small and
53simple. It is supported to serve just files and to do this in a good
54and fast way.  It is supposed to be HTTP/1.1 (RfC 2068) compliant.
55Conditional compliant as there is no entity tag support.
56
57
58Compile/Install
59===============
60
61$ make
62$ su -c "make install"
63
64See INSTALL for more details.
65
66
67Tuning
68======
69
70The default for the number of parallel connections is very low (32),
71you might have to raise this.
72
73You probably don't get better performance by turning on threads.  For
74static content I/O bandwidth is the bottleneck.  My box easily fills
75up the network bandwidth while webfsd uses less than 10% CPU time
76(Pentium III/450 MHz, Fast Ethernet, Tulip card).
77
78You might win with threads if you have a very fast network connection
79and a lot of traffic.  The sendfile() system call blocks if it has to
80read from harddisk.  While one thread waits for data in sendfile(),
81another can keep the network card busy.  You'll probably get best
82results with a small number of threads (2-3) per CPU.
83
84Enough RAM probably also helps to speed up things.  Although webfs
85itself will not need very much memory, your kernel will happily use
86the memory as cache for the data sent out via sendfile().
87
88I have no benchmark numbers for webfsd.
89
90
91Security
92========
93
94I can't guarantee that there are no security flaws.  If you find one,
95report it as a bug.  I've done my very best while writing webfsd, I hope
96there are no serious bugs like buffer overflows (and no other bugs of
97course...).  If webfsd dumps core, you /have/ a problem; this really
98shouldn't happen.
99
100Don't use versions below 1.20, there are known security holes.
101
102
103Changes in 1.21
104===============
105
106  * large file support.
107  * s/sprintf/snprintf/ in some places.
108  * changed timestamp handling, webfs doesn't attempt to parse them
109    any more but does a strcmp of rfc1123 dates.
110  * access log uses local time not GMT now.
111  * some ssl/cgi cleanups (based on patches from Ludo Stellingwerff).
112  * misc fixes.
113
114
115Changes in 1.20
116===============
117
118  * CGI pipe setup bugfix.
119  * Don't allow ".." as hostname (security hole with vhosts enabled).
120  * fix buffer overflow in ls.c with very long file names.
121  * misc other fixes / cleanups.
122
123
124Changes in 1.19
125===============
126
127  * documentation spell fixes (Ludo Stellingwerff).
128  * added missing items (last two) to the 1.18 Changes notes
129    (pointed out by Jedi/Sector One <j@pureftpd.org>).
130  * Makefile changes.
131  * finished user home-directory support.
132
133
134Changes in 1.18
135===============
136
137  * added -j switch.
138  * compile fixes for the threaded version.
139  * use accept filters (FreeBSD).
140  * shuffled around access log locks.
141  * added optional SSL support (based on patches by
142    Ludo Stellingwerff <ludo@jonkers.nl>).
143  * run only the absolute needed code with root privileges
144    (bind+chroot) if installed suid-root.
145  * Makefile tweaks.
146  * fixed buffer overflow in request.c
147  * started user home-directory support.
148
149
150Changes in 1.17
151===============
152
153  * fix bug in request cleanup code (didn't cleanup properly after
154    byte-range requests, thus making webfsd bomb out on non-range
155    requests following a byte-range request on the same keep-alive
156    connection).
157
158
159Changes in 1.16
160===============
161
162  * fix bug in %xx handling (adding CGI support broke this).
163
164
165Changes in 1.14
166===============
167
168  * allways use Host: supplied hostname if needed (redirect, ...).
169  * added -4 / -6 switches.
170  * Added CGI support (GET requests only).
171  * compile fix for OpenBSD
172
173
174Changes in 1.13
175===============
176
177  * fixed a bug in Basic authentication.
178
179
180Changes in 1.11
181===============
182
183  * bumped the version number this time :-)
184  * small freebsd update (use strmode).
185  * added -e switch.
186
187
188Changes in 1.10
189===============
190
191  * fixed byte rage header parser to deal correctly with 64bit off_t.
192
193
194Changes in 1.9
195==============
196
197  * added pidfile support.
198
199
200Changes in 1.8
201==============
202
203  * added TCP_CORK support.
204
205
206Changes in 1.7
207==============
208
209  * one more security fix (drop secondary groups).
210  * catch malloc() failures in ls.c.
211
212
213Changes in 1.6
214==============
215
216  * security fix (parsing option '-n' did unchecked strcpy).
217  * documentation updates.
218
219
220Changes in 1.5
221==============
222
223  * fixed the sloppy usage of addrlen for the ipv6 name lookup
224    functions.  Linux worked fine, but the BSD folks have some
225    more strict checks...
226  * allow to write the access log to stdout (use "-" as filename)
227
228
229Changes in 1.4
230==============
231
232  * fixed a bug in the base64 decoder (which broke basic auth for some
233    user/passwd combinations)
234  * added virtual host support.
235  * webfsd can chroot to $DOCUMENT_ROOT now.
236
237
238Changes in 1.3
239==============
240
241  * overwrite the -b user:pw command line option to hide the password
242    (doesn't show up in ps anymore)
243
244
245Changes in 1.2
246==============
247
248  * added ipv6 support.
249  * bugfix in logfile timestamps.
250
251
252Changes in 1.1
253==============
254
255  * added basic authentication (one username/password for all files)
256
257
258Changes in 1.0
259==============
260
261  * added some casts to compile cleanly on Solaris.
262  * new -F flag (don't run as daemon).
263
264
265Changes in 0.9
266==============
267
268  * fixed a quoting bug.
269  * documentation updates, minor tweaks.
270
271
272Changes in 0.8
273==============
274
275  * fixed a bug in the directory cache.
276  * fixed uncatched malloc()/realloc() failures.
277  * added optional pthreads support.  Edit the Makefile to turn
278    it on.
279
280
281Changes in 0.7
282==============
283
284  * some portability problems fixed (0.6 didn't compile on FreeBSD).
285  * added a sendfile() emulation based on read()/write() as fallback
286    if there is no sendfile() available.
287  * bugfix: '#' must be quoted too...
288
289
290Changes in 0.6
291==============
292
293  * increased the listen backlog.
294  * optionally flush every logfile line to disk.
295  * new switch to specify the location of the mime.types file.
296  * byte range bug fixes.
297  * switch for the hostname has been changed ('-s' => '-n').
298  * optional log errors to the syslog (switch '-s').
299  * added sample start/stop script for RedHat.
300
301
302Changes in 0.5
303==============
304
305  * FreeBSD port (Charles Randall <crandall@matchlogic.com>)
306  * minor tweaks and spelling fixes.
307
308
309Changes in 0.4
310==============
311
312  * last-modified headers (and 304 responses) for directory listings.
313  * new switch: -f index.html (or whatever you want to use for
314    directory indices)
315  * killed the access() system calls in the ls() function.
316  * added cache for user/group names.
317  * wrote a manual page.
318
319
320Changes in 0.3
321==============
322
323  * multipart/byteranges improved:  You'll get a correct Content-length:
324    header for the whole thing, and we can handle keep-alive on these
325    requests now.
326  * bugfix: catch accept() failures.
327  * bugfix: quote the path in 302 redirect responses.
328  * accept absolute URLs ("GET http://host/path HTTP/1.1")
329  * fixed handling of conditional GET requests (hope it is RFC-Compilant
330    now...).
331  * bugfix: '+' must be quoted using %xx.
332
333
334Changes in 0.2
335==============
336
337  * added URL quoting.
338  * root can set uid/gid now.
339  * webfs ditches any setuid/setgid priviliges after binding to the
340    TCP port by setting effective to real uid/gid.  It should be safe
341    to install webfsd suid root to allow users to use ports below
342    1024 (and _only_ this of course).  If anyone finds a flaw in this
343    code drop me a note.
344  * more verbose directory listing.
345  * added logging. It does the usual logfile reopen on SIGHUP.
346
347
348Changes in 0.1
349==============
350
351  * first public release.
352
353
354Have fun,
355  Gerd
356
357--
358Gerd Knorr <kraxel@bytesex.org>
359