Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | send 400 bad request and drop connection on http parse errors HEAD master | Leah Neukirchen | 2022-02-07 | 1 | -0/+11 |
| | | | | | | Reported by @ellcs. Closes #2. | ||||
* | Close clients when max clients exceeded | elx | 2022-02-07 | 1 | -1/+6 |
| | | | | | | | | After compiling with `-fsanitize=address`, you can see that hittpd would crash with the following commands: ulimit -n 4096; ./hittpd for i in {1..1024}; do (echo ""; sleep 5) > /dev/tcp/127.0.0.1/80 & done | ||||
* | sig_atomic_t should be used with volatile | Leah Neukirchen | 2022-01-27 | 1 | -1/+1 |
| | |||||
* | write_client: when sendfile(2) fails, try pread/write. | Leah Neukirchen | 2022-01-24 | 1 | -9/+15 |
| | | | | | | | Some filesystems don't support sendfile, either due to bugs or other reasons. Found by Érico Nogueira. | ||||
* | detect and refuse pipelining | Leah Neukirchen | 2022-01-13 | 3 | -4/+19 |
| | | | | | | | | | | | | | | | | | Previously, two HTTP requests within the same read() would both be parsed by http_parser_execute (and corrupted state). We don't support this, since we distinguish between reading and writing parts of the server action, and there's no way to let poll perform the writing part in this case. Detect pipelining by pausing the parser in on_message_complete and checking if we parsed fewer bytes than we passed. Then handle the first request and drop the connection; a compliant HTTP client must retry without pipelining. Found by @duncaen. Signed-off-by: Leah Neukirchen <leah@vuxu.org> | ||||
* | getmime: robustness for empty mime table | Leah Neukirchen | 2021-08-10 | 1 | -1/+2 |
| | | | | Found by Érico Nogueira. | ||||
* | gather globals | Leah Neukirchen | 2021-08-10 | 1 | -9/+9 |
| | |||||
* | clean up, don't shadow timestamp | Leah Neukirchen | 2021-08-10 | 1 | -4/+4 |
| | |||||
* | accesslog: clean up, rename buf to logtimestamp | Leah Neukirchen | 2021-08-10 | 1 | -3/+4 |
| | |||||
* | fix mimetype lookup | Leah Neukirchen | 2021-08-10 | 1 | -12/+26 |
| | | | | | | | Fix overflow on long mime types, found by Érico Nogueira. Allow maximum length of mime types, as per spec, then truncate. Fix mime type lookup when extensions match some mime type. | ||||
* | Makefile: make incompatible pointer types fatal | Leah Neukirchen | 2021-08-09 | 1 | -1/+1 |
| | |||||
* | scan_int64: don't assume long fits 64-bits | Leah Neukirchen | 2021-08-09 | 1 | -2/+2 |
| | |||||
* | fix mimetype for "GET /" requests | Érico Nogueira | 2021-08-09 | 1 | -1/+6 |
| | | | | | | | index.html was being sent as "application/octet-stream", which broke it for browsers. using strcat is safe, because we check the length before writing. we can't use strcpy because subdirs can also be requested this way. | ||||
* | more robustness | Leah Neukirchen | 2021-06-03 | 1 | -1/+2 |
| | |||||
* | detect unsatisfiable empty ranges | Leah Neukirchen | 2021-06-03 | 1 | -0/+5 |
| | | | | This fixes wget -c. | ||||
* | bump copyright years | Leah Neukirchen | 2021-06-03 | 2 | -2/+2 |
| | |||||
* | reset stream state in finish_response | Leah Neukirchen | 2021-06-03 | 1 | -0/+5 |
| | | | | | This fixes wrong partial content answers on keep-alive requests, detected with mobile Chrome 89. | ||||
* | Partial Content is 206, duh | Leah Neukirchen | 2020-09-25 | 1 | -1/+1 |
| | |||||
* | with -P, only list files that will be served | Leah Neukirchen | 2020-05-23 | 1 | -0/+3 |
| | |||||
* | nicer index list, inspired by nginx | Leah Neukirchen | 2020-05-23 | 1 | -14/+39 |
| | |||||
* | remove double casting via (void *) | Leah Neukirchen | 2020-05-20 | 1 | -5/+4 |
| | |||||
* | explain how to run with CAP_NET_BIND_SERVICE | Leah Neukirchen | 2020-05-15 | 1 | -0/+5 |
| | |||||
* | fix formatting | Leah Neukirchen | 2020-05-15 | 1 | -19/+19 |
| | |||||
* | detect file truncation | Leah Neukirchen | 2020-05-15 | 1 | -2/+6 |
| | | | | We have to close the connection here to notify the client. | ||||
* | display address hittpd listens on | Leah Neukirchen | 2020-05-15 | 1 | -5/+21 |
| | |||||
* | add -R to set SO_REUSEPORT | Leah Neukirchen | 2020-05-10 | 1 | -2/+13 |
| | |||||
* | compute timestamp once per iteration | Leah Neukirchen | 2020-05-10 | 1 | -9/+9 |
| | |||||
* | ignore peer address when accepting | Leah Neukirchen | 2020-05-10 | 1 | -5/+3 |
| | |||||
* | better error handling in write_client | Leah Neukirchen | 2020-05-09 | 1 | -7/+11 |
| | |||||
* | allow setting default mimetype, default to application/octet-stream | Leah Neukirchen | 2020-05-09 | 1 | -6/+6 |
| | |||||
* | allow custom mime types | Leah Neukirchen | 2020-05-09 | 1 | -2/+7 |
| | |||||
* | nicely exit on SIGINT and SIGTERM | Leah Neukirchen | 2020-05-09 | 1 | -3/+28 |
| | |||||
* | good morning | Leah Neukirchen | 2020-05-09 | 1 | -3/+3 |
| | |||||
* | add -P to only serve world-readable files | Leah Neukirchen | 2020-05-09 | 1 | -2/+9 |
| | | | | | Note that this does not check intermediate directory traversals, for this u+x is still enough. | ||||
* | add -I to disable directory indexes | Leah Neukirchen | 2020-05-09 | 1 | -2/+7 |
| | |||||
* | send_dir_redirect: send newline too | Leah Neukirchen | 2020-05-09 | 1 | -1/+1 |
| | |||||
* | escape path in accesslog | Leah Neukirchen | 2020-05-09 | 1 | -3/+10 |
| | |||||
* | detect too big header generation | Leah Neukirchen | 2020-05-09 | 1 | -1/+12 |
| | |||||
* | fix empty Content-Length for HEAD | Leah Neukirchen | 2020-05-09 | 1 | -3/+3 |
| | |||||
* | send content for 301 responses | Leah Neukirchen | 2020-05-09 | 1 | -2/+3 |
| | |||||
* | refactor response generation | Leah Neukirchen | 2020-05-09 | 1 | -106/+57 |
| | |||||
* | send_error: refactor | Leah Neukirchen | 2020-05-09 | 1 | -7/+15 |
| | |||||
* | use intmax_t to print off_t values | Leah Neukirchen | 2020-05-09 | 1 | -12/+22 |
| | |||||
* | add support for listening on unix domain sockets (-u) | Leah Neukirchen | 2020-05-09 | 1 | -31/+50 |
| | |||||
* | use AF_UNSPEC if AI_V4MAPPED is not available | Leah Neukirchen | 2020-05-09 | 1 | -3/+5 |
| | | | | Else we can't listen IPv4 only on these systems. | ||||
* | Makefile: make work with bmake | Leah Neukirchen | 2020-05-08 | 1 | -0/+4 |
| | |||||
* | rename OPEN_MAX to MAX_CLIENTS | Leah Neukirchen | 2020-05-08 | 1 | -8/+7 |
| | |||||
* | use AI_V4MAPPED only if available | Leah Neukirchen | 2020-05-08 | 1 | -1/+4 |
| | |||||
* | add strptime prototype for glibc, use default visibility | Leah Neukirchen | 2020-05-08 | 1 | -3/+5 |
| | |||||
* | simply enable sendfile on linux | Leah Neukirchen | 2020-05-08 | 2 | -3/+3 |
| |