{"id":20347112,"url":"https://github.com/ourway/webfsd","last_synced_at":"2026-03-16T20:38:16.043Z","repository":{"id":27944810,"uuid":"31437437","full_name":"ourway/webfsd","owner":"ourway","description":" A simple HTTP server for mostly static content written in C","archived":false,"fork":false,"pushed_at":"2023-03-08T00:59:14.000Z","size":61,"stargazers_count":94,"open_issues_count":6,"forks_count":18,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-12T00:52:38.234Z","etag":null,"topics":["asyncio","byte-range","c","embedded","freebsd","httpserver","ipv6","keeplive","makefile","nginx","noconfig","sendfile","ssl-support","thread","virtual-host","webfs","webserver"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ourway.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-27T20:20:10.000Z","updated_at":"2025-03-14T11:11:39.000Z","dependencies_parsed_at":"2022-09-03T03:03:47.868Z","dependency_job_id":null,"html_url":"https://github.com/ourway/webfsd","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ourway%2Fwebfsd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ourway%2Fwebfsd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ourway%2Fwebfsd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ourway%2Fwebfsd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ourway","download_url":"https://codeload.github.com/ourway/webfsd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501885,"owners_count":21114682,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","byte-range","c","embedded","freebsd","httpserver","ipv6","keeplive","makefile","nginx","noconfig","sendfile","ssl-support","thread","virtual-host","webfs","webserver"],"created_at":"2024-11-14T22:15:24.566Z","updated_at":"2026-03-16T20:38:16.002Z","avatar_url":"https://github.com/ourway.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nThis is a simple http server for pure static content.  You\ncan use it to serve the content of a ftp server via http for\nexample.  It is also nice to export some files the quick way\nby starting a http server in a few seconds, without editing\nsome config file first.\n\nIt uses sendfile() and knows how to use sendfile on linux and FreeBSD.\nAdding other systems shouldn't be difficult.  To use it with linux\nyou'll need a 2.2.x kernel and glibc 2.1.\n\nThere is some sendfile emulation code which uses a userland bounce\nbuffer, this allows to compile and use webfs on systems without\nsendfile().\n\nTry it:\n=======\n```console\ndocker run -it -v `pwd`:\"/storage\" -p 8000:8000 --rm farshidashouri/webfsd\n```\n\nFeatures/Design:\n================\n\n * single process: select() + non-blocking I/O.\n * trimmed to use as few system calls as possible per request.\n * use sendfile to avoid copying data to userspace.\n * optional thread support.  Every thread has its own select\n   loop then (compile time option, off by default, edit the\n   Makefile to turn it on).\n * automatically generates directory listings when asked for a\n   directory (check for index.html available as option), caches\n   the listings.\n * no config file, just a few switches.  Try \"webfsd -h\" for a\n   list, check the man page for a more indepth description.\n * Uses /etc/mime.types to map file extentions to mime/types.\n * Uses normal unix access rights, it will deliver every regular\n   file it is able to open for reading.  If you want it to serve\n   public-readable files only, make sure it runs as nobody/nogroup.\n * supports keep-alive and pipelined requests.\n * serves byte ranges.\n * supports virtual hosts.\n * supports ipv6.\n * optional logging in common log file format.\n * optional error logging (to syslog / stderr).\n * limited CGI support (GET requests only).\n * optional SSL support.\n\nTry it\n======\n```console\ndocker run -it -v `pwd`:\"/storage\" -p 8000:8000 --rm farshidashouri/webfsd\n```\n\nPlans/BUGS/TODO\n===============\n\n * figure out why the acroread plugin doesn't like my\n   multipart/byteranges responses.\n * benchmarking / profiling.\n\nDon't expect much more features.  I want to keep it small and\nsimple. It is supported to serve just files and to do this in a good\nand fast way.  It is supposed to be HTTP/1.1 (RfC 2068) compliant.\nConditional compliant as there is no entity tag support.\n\n\nCompile/Install\n===============\n\n$ make\n$ su -c \"make install\"\n\nSee INSTALL for more details.\n\n\nTuning\n======\n\nThe default for the number of parallel connections is very low (32),\nyou might have to raise this.\n\nYou probably don't get better performance by turning on threads.  For\nstatic content I/O bandwidth is the bottleneck.  My box easily fills\nup the network bandwidth while webfsd uses less than 10% CPU time\n(Pentium III/450 MHz, Fast Ethernet, Tulip card).\n\nYou might win with threads if you have a very fast network connection\nand a lot of traffic.  The sendfile() system call blocks if it has to\nread from harddisk.  While one thread waits for data in sendfile(),\nanother can keep the network card busy.  You'll probably get best\nresults with a small number of threads (2-3) per CPU.\n\nEnough RAM probably also helps to speed up things.  Although webfs\nitself will not need very much memory, your kernel will happily use\nthe memory as cache for the data sent out via sendfile().\n\nI have no benchmark numbers for webfsd.\n\n\nSecurity\n========\n\nI can't guarantee that there are no security flaws.  If you find one,\nreport it as a bug.  I've done my very best while writing webfsd, I hope\nthere are no serious bugs like buffer overflows (and no other bugs of\ncourse...).  If webfsd dumps core, you /have/ a problem; this really\nshouldn't happen.\n\nDon't use versions below 1.20, there are known security holes.\n\n\nChanges in 1.21\n===============\n\n  * large file support.\n  * s/sprintf/snprintf/ in some places.\n  * changed timestamp handling, webfs doesn't attempt to parse them\n    any more but does a strcmp of rfc1123 dates.\n  * access log uses local time not GMT now.\n  * some ssl/cgi cleanups (based on patches from Ludo Stellingwerff).\n  * misc fixes.\n\n\nChanges in 1.20\n===============\n\n  * CGI pipe setup bugfix.\n  * Don't allow \"..\" as hostname (security hole with vhosts enabled).\n  * fix buffer overflow in ls.c with very long file names.\n  * misc other fixes / cleanups.\n\n\nChanges in 1.19\n===============\n\n  * documentation spell fixes (Ludo Stellingwerff).\n  * added missing items (last two) to the 1.18 Changes notes\n    (pointed out by Jedi/Sector One \u003cj@pureftpd.org\u003e).\n  * Makefile changes.\n  * finished user home-directory support.\n\n\nChanges in 1.18\n===============\n\n  * added -j switch.\n  * compile fixes for the threaded version.\n  * use accept filters (FreeBSD).\n  * shuffled around access log locks.\n  * added optional SSL support (based on patches by\n    Ludo Stellingwerff \u003cludo@jonkers.nl\u003e).\n  * run only the absolute needed code with root privileges\n    (bind+chroot) if installed suid-root.\n  * Makefile tweaks.\n  * fixed buffer overflow in request.c\n  * started user home-directory support.\n\n\nChanges in 1.17\n===============\n\n  * fix bug in request cleanup code (didn't cleanup properly after\n    byte-range requests, thus making webfsd bomb out on non-range\n    requests following a byte-range request on the same keep-alive\n    connection).\n\n\nChanges in 1.16\n===============\n\n  * fix bug in %xx handling (adding CGI support broke this).\n\n\nChanges in 1.14\n===============\n\n  * allways use Host: supplied hostname if needed (redirect, ...).\n  * added -4 / -6 switches.\n  * Added CGI support (GET requests only).\n  * compile fix for OpenBSD\n\n\nChanges in 1.13\n===============\n\n  * fixed a bug in Basic authentication.\n\n\nChanges in 1.11\n===============\n\n  * bumped the version number this time :-)\n  * small freebsd update (use strmode).\n  * added -e switch.\n\n\nChanges in 1.10\n===============\n\n  * fixed byte rage header parser to deal correctly with 64bit off_t.\n\n\nChanges in 1.9\n==============\n\n  * added pidfile support.\n\n\nChanges in 1.8\n==============\n\n  * added TCP_CORK support.\n\n\nChanges in 1.7\n==============\n\n  * one more security fix (drop secondary groups).\n  * catch malloc() failures in ls.c.\n\n\nChanges in 1.6\n==============\n\n  * security fix (parsing option '-n' did unchecked strcpy).\n  * documentation updates.\n\n\nChanges in 1.5\n==============\n\n  * fixed the sloppy usage of addrlen for the ipv6 name lookup\n    functions.  Linux worked fine, but the BSD folks have some\n    more strict checks...\n  * allow to write the access log to stdout (use \"-\" as filename)\n\n\nChanges in 1.4\n==============\n\n  * fixed a bug in the base64 decoder (which broke basic auth for some\n    user/passwd combinations)\n  * added virtual host support.\n  * webfsd can chroot to $DOCUMENT_ROOT now.\n\n\nChanges in 1.3\n==============\n\n  * overwrite the -b user:pw command line option to hide the password\n    (doesn't show up in ps anymore)\n\n\nChanges in 1.2\n==============\n\n  * added ipv6 support.\n  * bugfix in logfile timestamps.\n\n\nChanges in 1.1\n==============\n\n  * added basic authentication (one username/password for all files)\n\n\nChanges in 1.0\n==============\n\n  * added some casts to compile cleanly on Solaris.\n  * new -F flag (don't run as daemon).\n\n\nChanges in 0.9\n==============\n\n  * fixed a quoting bug.\n  * documentation updates, minor tweaks.\n\n\nChanges in 0.8\n==============\n\n  * fixed a bug in the directory cache.\n  * fixed uncatched malloc()/realloc() failures.\n  * added optional pthreads support.  Edit the Makefile to turn\n    it on.\n\n\nChanges in 0.7\n==============\n\n  * some portability problems fixed (0.6 didn't compile on FreeBSD).\n  * added a sendfile() emulation based on read()/write() as fallback\n    if there is no sendfile() available.\n  * bugfix: '#' must be quoted too...\n\n\nChanges in 0.6\n==============\n\n  * increased the listen backlog.\n  * optionally flush every logfile line to disk.\n  * new switch to specify the location of the mime.types file.\n  * byte range bug fixes.\n  * switch for the hostname has been changed ('-s' =\u003e '-n').\n  * optional log errors to the syslog (switch '-s').\n  * added sample start/stop script for RedHat.\n\n\nChanges in 0.5\n==============\n\n  * FreeBSD port (Charles Randall \u003ccrandall@matchlogic.com\u003e)\n  * minor tweaks and spelling fixes.\n\n\nChanges in 0.4\n==============\n\n  * last-modified headers (and 304 responses) for directory listings.\n  * new switch: -f index.html (or whatever you want to use for\n    directory indices)\n  * killed the access() system calls in the ls() function.\n  * added cache for user/group names.\n  * wrote a manual page.\n\n\nChanges in 0.3\n==============\n\n  * multipart/byteranges improved:  You'll get a correct Content-length:\n    header for the whole thing, and we can handle keep-alive on these\n    requests now.\n  * bugfix: catch accept() failures.\n  * bugfix: quote the path in 302 redirect responses.\n  * accept absolute URLs (\"GET http://host/path HTTP/1.1\")\n  * fixed handling of conditional GET requests (hope it is RFC-Compilant\n    now...).\n  * bugfix: '+' must be quoted using %xx.\n\n\nChanges in 0.2\n==============\n\n  * added URL quoting.\n  * root can set uid/gid now.\n  * webfs ditches any setuid/setgid priviliges after binding to the\n    TCP port by setting effective to real uid/gid.  It should be safe\n    to install webfsd suid root to allow users to use ports below\n    1024 (and _only_ this of course).  If anyone finds a flaw in this\n    code drop me a note.\n  * more verbose directory listing.\n  * added logging. It does the usual logfile reopen on SIGHUP.\n\n\nChanges in 0.1\n==============\n\n  * first public release.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fourway%2Fwebfsd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fourway%2Fwebfsd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fourway%2Fwebfsd/lists"}