Commit Graph

374 Commits

Author SHA1 Message Date
Emil Mikulic
b02c1bba08 urlencode file names when generating directory listing.
Noticed by, patched by: nf
2013-04-28 20:20:29 +10:00
Emil Mikulic
3e2e53a33e [ darkhttpd-1.6 release ]
Update copyright years.
2013-04-28 20:20:29 +10:00
Emil Mikulic
b70dcdfab6 Ubuntu hides uname somewhere else. Don't use a full path. 2013-04-28 20:20:29 +10:00
Emil Mikulic
820b5c2e3b Five-letter patch that fixes a use-after-free and possible list
corruption.  Don't know how far back this bug goes.  Caught and
diagnosed on an Ubuntu system where it manifested as a segfault.
2013-04-28 20:20:29 +10:00
Emil Mikulic
f5c051aad5 [ darkhttpd-1.5 release ]
(we skipped 1.4 due to a release engineering oversight)

Update README to reflect Makefile changes.
2013-04-28 20:20:06 +10:00
Emil Mikulic
1a161a47ce Simplify the Makefile. 2013-04-28 19:56:51 +10:00
Emil Mikulic
4cddcf96a5 Not sure if we were taking the size of the right thing previously.
Zero out the sockaddr_in before having accept() write to it.
This un-confuses bcheck on Solaris, at least.
2013-04-28 19:56:51 +10:00
Emil Mikulic
0819e7c3c6 Revert - don't bother with tzset. 2013-04-28 19:56:51 +10:00
Emil Mikulic
cfcbdf0ad7 Stuff to do when I find the time. 2013-04-28 19:56:51 +10:00
Emil Mikulic
6690b3c7cf If sendfile blocks and sends zero bytes, treat it as blocking and not
end-of-file.  This is a really rare corner case.
2013-04-28 19:56:51 +10:00
Emil Mikulic
c23550f165 Cache time and update it once per event loop iteration.
This cuts down the number of gettimeofday() calls for a single request
from 5 to 1.
2013-04-28 19:56:51 +10:00
Emil Mikulic
400ee17051 Slightly re-arrange the way recycling of keep-alive connections is
handled.  Unfortunately, I'm still seeing horrible performance.
2013-04-28 19:56:51 +10:00
Emil Mikulic
29cbe09d4c Minor tweaks. 2013-04-28 19:56:51 +10:00
Emil Mikulic
3e96ddf6d6 Implement disabling TCP_NODELAY, but comment it out.
It makes performance worse.
2013-04-28 19:56:51 +10:00
Emil Mikulic
008f6f5d4e We can handle a request from accept() to close() without having to go through a
single iteration of the select() loop.

This commit re-orders the way state == DONE is handled so that keep-alive
connections can go straight back into recv_request without visiting select().
Unfortunately, this doesn't fix the keep-alive performance.
2013-04-28 19:56:51 +10:00
Emil Mikulic
5ab0496a9b Call tzset() during initialization.
truss output suggests this isn't enough to load posixrules (UTC leap
seconds data) which happens only after the first request.  =(
2013-04-28 19:56:51 +10:00
Emil Mikulic
3ed2762831 Another state transition optimization:
Go from send_header straight to send_reply.
2013-04-28 19:56:51 +10:00
Emil Mikulic
844dcc6b9d Another state transition optimization due to NBIO:
Go from recv_request to send_header without visiting select()
2013-04-28 19:56:51 +10:00
Emil Mikulic
ba91f1cdb3 After accepting a connection, attempt a read straight away instead of
going through an iteration of the select() loop.
2013-04-28 19:56:50 +10:00
Emil Mikulic
f3ce5d1eb9 Don't just SETFL O_NONBLOCK, first GETFL. 2013-04-28 19:56:50 +10:00
Emil Mikulic
b86889f027 %Z gives UTC. Apache uses GMT instead, and wget complains about an
invalid header when it sees UTC, so switch.
2013-04-28 19:56:50 +10:00
Emil Mikulic
14d0ca9ac7 Get the constness right. 2013-04-28 19:56:50 +10:00
Emil Mikulic
625dc5e473 - In decode_url()
- Use '\0' instead of 0 to hint that it's in a character context.
  - Don't realloc - this wastes more time than it saves memory.
- Don't forget to free decoded url if it's found to be unsafe!
2013-04-28 19:56:50 +10:00
Emil Mikulic
ccea5116b5 Restore a check I shouldn't have removed.
We now pass all our tests again.
2013-04-28 19:56:50 +10:00
Emil Mikulic
4b90b875c6 Adapt make_safe_uri() to work in-place.
We're currently failing some tests.
2013-04-28 19:56:50 +10:00
Emil Mikulic
97ce3cb5d0 Turn up the debugging and warnflags. 2013-04-28 19:56:50 +10:00
Emil Mikulic
dc63087421 Test for consolidate_slashes() too. 2013-04-28 19:56:50 +10:00
Emil Mikulic
d7707a9216 Remember to free memory. 2013-04-28 19:56:50 +10:00
Emil Mikulic
a0afb2cc8b Add tests for make_safe_uri. 2013-04-28 19:56:50 +10:00
Emil Mikulic
e6c8b820fd Rename warnflags to debug-build and add debugging and torture defines. 2013-04-28 19:56:50 +10:00
Emil Mikulic
6d24c697b1 Request a bigger file -> more testing. 2013-04-28 19:56:50 +10:00
Emil Mikulic
af7d21c31e Torture test: send and recv one byte at a time to make sure darkhttpd's
buffering is up to scratch.
2013-04-28 19:56:50 +10:00
Emil Mikulic
ab1204f700 Implement (optional, compile-time) shrinking of send buffer for torture tests. 2013-04-28 19:56:50 +10:00
Emil Mikulic
94d3403c2e Remove the pidfile_path assertion entirely.
Its name changed but I didn't notice because I didn't do any DEBUG builds.
2013-04-28 19:56:50 +10:00
Emil Mikulic
b307616f3d Fix some GCC warnings.
Pointed out by: Brian Lewis <bsl04@uark.edu>
Pointed out on: Wed, 27 Sep 2006 15:46:26 -0500
2013-04-28 19:56:50 +10:00
Emil Mikulic
de03d20958 Need some release engineering reminders after I failed to update the pkgname
when I released v1.4.
2013-04-28 19:56:50 +10:00
Emil Mikulic
4a405e36b1 Walking through the code - correct some comment typos. 2013-04-28 19:56:50 +10:00
Emil Mikulic
c2ff18a157 [ darkhttpd-1.4 release ]
Fix a segfault in log_connection() that happens when the incoming
request is too long.

(Forgot to bump the version)
2013-04-28 19:56:50 +10:00
Emil Mikulic
c9947250f2 [ darkhttpd-1.3 release ]
Also remove an unused variable.
2013-04-28 19:56:50 +10:00
Emil Mikulic
868c1ed1da Don't need libutil anymore. 2013-04-28 19:56:50 +10:00
Emil Mikulic
572eed9e3a Add example of --dameon and --pidfile to README. 2013-04-28 19:56:50 +10:00
Emil Mikulic
953a93d2fc Import pidfile helpers and cut them down to just the pieces we need. 2013-04-28 19:56:50 +10:00
Emil Mikulic
c3166bf1d0 Implement warn() 2013-04-28 19:55:48 +10:00
Emil Mikulic
2d4fbd38cd Implement daemonize. 2013-04-28 19:55:48 +10:00
Emil Mikulic
cad637254a Add mimetypes, sort them, remove lots of whitespace from the middle. 2013-04-28 19:55:48 +10:00
Emil Mikulic
ff152e87ef Update copyright years. 2013-04-28 19:55:36 +10:00
Emil Mikulic
25eea59af9 We need libutil on BSD now. 2013-04-28 19:44:12 +10:00
Emil Mikulic
258d54ed8c You don't "usually" need root privs for chroot(), you always do. 2013-04-28 19:44:12 +10:00
Emil Mikulic
4fed6d0665 Implement --pidfile and move clean shutdown into main() 2013-04-28 19:44:12 +10:00
Emil Mikulic
42833fb312 Fix build on FreeBSD by spelling "sockin" correctly.
This has been outstanding for a long time.
2013-04-28 19:44:12 +10:00