|
| 1 | + |
| 2 | +This is a simple http server for pure static content. You |
| 3 | +can use it to serve the content of a ftp server via http for |
| 4 | +example. It is also nice to export some files the quick way |
| 5 | +by starting a http server in a few seconds, without editing |
| 6 | +some config file first. |
| 7 | + |
| 8 | +It uses sendfile() and knows how to use sendfile on linux and FreeBSD. |
| 9 | +Adding other systems shouldn't be difficult. To use it with linux |
| 10 | +you'll need a 2.2.x kernel and glibc 2.1. |
| 11 | + |
| 12 | +There is some sendfile emulation code which uses a userland bounce |
| 13 | +buffer, this allows to compile and use webfs on systems without |
| 14 | +sendfile(). |
| 15 | + |
| 16 | + |
| 17 | +Features/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 | + |
| 45 | +Plans/BUGS/TODO |
| 46 | +=============== |
| 47 | + |
| 48 | + * figure out why the acroread plugin doesn't like my |
| 49 | + multipart/byteranges responses. |
| 50 | + * benchmarking / profiling. |
| 51 | + |
| 52 | +Don't expect much more features. I want to keep it small and |
| 53 | +simple. It is supported to serve just files and to do this in a good |
| 54 | +and fast way. It is supposed to be HTTP/1.1 (RfC 2068) compliant. |
| 55 | +Conditional compliant as there is no entity tag support. |
| 56 | + |
| 57 | + |
| 58 | +Compile/Install |
| 59 | +=============== |
| 60 | + |
| 61 | +$ make |
| 62 | +$ su -c "make install" |
| 63 | + |
| 64 | +See INSTALL for more details. |
| 65 | + |
| 66 | + |
| 67 | +Tuning |
| 68 | +====== |
| 69 | + |
| 70 | +The default for the number of parallel connections is very low (32), |
| 71 | +you might have to raise this. |
| 72 | + |
| 73 | +You probably don't get better performance by turning on threads. For |
| 74 | +static content I/O bandwidth is the bottleneck. My box easily fills |
| 75 | +up the network bandwidth while webfsd uses less than 10% CPU time |
| 76 | +(Pentium III/450 MHz, Fast Ethernet, Tulip card). |
| 77 | + |
| 78 | +You might win with threads if you have a very fast network connection |
| 79 | +and a lot of traffic. The sendfile() system call blocks if it has to |
| 80 | +read from harddisk. While one thread waits for data in sendfile(), |
| 81 | +another can keep the network card busy. You'll probably get best |
| 82 | +results with a small number of threads (2-3) per CPU. |
| 83 | + |
| 84 | +Enough RAM probably also helps to speed up things. Although webfs |
| 85 | +itself will not need very much memory, your kernel will happily use |
| 86 | +the memory as cache for the data sent out via sendfile(). |
| 87 | + |
| 88 | +I have no benchmark numbers for webfsd. |
| 89 | + |
| 90 | + |
| 91 | +Security |
| 92 | +======== |
| 93 | + |
| 94 | +I can't guarantee that there are no security flaws. If you find one, |
| 95 | +report it as a bug. I've done my very best while writing webfsd, I hope |
| 96 | +there are no serious bugs like buffer overflows (and no other bugs of |
| 97 | +course...). If webfsd dumps core, you /have/ a problem; this really |
| 98 | +shouldn't happen. |
| 99 | + |
| 100 | +Don't use versions below 1.20, there are known security holes. |
| 101 | + |
| 102 | + |
| 103 | +Changes 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 | + |
| 115 | +Changes 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 | + |
| 124 | +Changes 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 <[email protected]>). |
| 130 | + * Makefile changes. |
| 131 | + * finished user home-directory support. |
| 132 | + |
| 133 | + |
| 134 | +Changes 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 <[email protected]>). |
| 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 | + |
| 150 | +Changes 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 | + |
| 159 | +Changes in 1.16 |
| 160 | +=============== |
| 161 | + |
| 162 | + * fix bug in %xx handling (adding CGI support broke this). |
| 163 | + |
| 164 | + |
| 165 | +Changes 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 | + |
| 174 | +Changes in 1.13 |
| 175 | +=============== |
| 176 | + |
| 177 | + * fixed a bug in Basic authentication. |
| 178 | + |
| 179 | + |
| 180 | +Changes in 1.11 |
| 181 | +=============== |
| 182 | + |
| 183 | + * bumped the version number this time :-) |
| 184 | + * small freebsd update (use strmode). |
| 185 | + * added -e switch. |
| 186 | + |
| 187 | + |
| 188 | +Changes in 1.10 |
| 189 | +=============== |
| 190 | + |
| 191 | + * fixed byte rage header parser to deal correctly with 64bit off_t. |
| 192 | + |
| 193 | + |
| 194 | +Changes in 1.9 |
| 195 | +============== |
| 196 | + |
| 197 | + * added pidfile support. |
| 198 | + |
| 199 | + |
| 200 | +Changes in 1.8 |
| 201 | +============== |
| 202 | + |
| 203 | + * added TCP_CORK support. |
| 204 | + |
| 205 | + |
| 206 | +Changes in 1.7 |
| 207 | +============== |
| 208 | + |
| 209 | + * one more security fix (drop secondary groups). |
| 210 | + * catch malloc() failures in ls.c. |
| 211 | + |
| 212 | + |
| 213 | +Changes in 1.6 |
| 214 | +============== |
| 215 | + |
| 216 | + * security fix (parsing option '-n' did unchecked strcpy). |
| 217 | + * documentation updates. |
| 218 | + |
| 219 | + |
| 220 | +Changes 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 | + |
| 229 | +Changes 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 | + |
| 238 | +Changes 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 | + |
| 245 | +Changes in 1.2 |
| 246 | +============== |
| 247 | + |
| 248 | + * added ipv6 support. |
| 249 | + * bugfix in logfile timestamps. |
| 250 | + |
| 251 | + |
| 252 | +Changes in 1.1 |
| 253 | +============== |
| 254 | + |
| 255 | + * added basic authentication (one username/password for all files) |
| 256 | + |
| 257 | + |
| 258 | +Changes 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 | + |
| 265 | +Changes in 0.9 |
| 266 | +============== |
| 267 | + |
| 268 | + * fixed a quoting bug. |
| 269 | + * documentation updates, minor tweaks. |
| 270 | + |
| 271 | + |
| 272 | +Changes 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 | + |
| 281 | +Changes 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 | + |
| 290 | +Changes 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 | + |
| 302 | +Changes in 0.5 |
| 303 | +============== |
| 304 | + |
| 305 | + * FreeBSD port (Charles Randall <[email protected]>) |
| 306 | + * minor tweaks and spelling fixes. |
| 307 | + |
| 308 | + |
| 309 | +Changes 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 | + |
| 320 | +Changes 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 | + |
| 334 | +Changes 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 | + |
| 348 | +Changes in 0.1 |
| 349 | +============== |
| 350 | + |
| 351 | + * first public release. |
| 352 | + |
| 353 | + |
| 354 | +Have fun, |
| 355 | + Gerd |
| 356 | + |
| 357 | +-- |
| 358 | + |
0 commit comments