darkhttpd
7 years agoWorking on unit tests.
Emil Mikulic [Mon, 17 Jan 2011 12:44:02 +0000 (23:44 +1100)]
Working on unit tests.

7 years agoFor developers: script to run through clang static analyzer.
Emil Mikulic [Sat, 15 Jan 2011 09:56:30 +0000 (20:56 +1100)]
For developers: script to run through clang static analyzer.

7 years agoAnother developer script - clang with warnings.
Emil Mikulic [Sat, 15 Jan 2011 09:54:15 +0000 (20:54 +1100)]
Another developer script - clang with warnings.

7 years agoFor developers - build with lots of warnings.
Emil Mikulic [Sat, 15 Jan 2011 09:51:07 +0000 (20:51 +1100)]
For developers - build with lots of warnings.

7 years agoDon't qsort() NULL.
Emil Mikulic [Sat, 15 Jan 2011 09:38:31 +0000 (20:38 +1100)]
Don't qsort() NULL.

Found by: clang static analyzer

7 years agoFix clang nits.
Emil Mikulic [Sat, 15 Jan 2011 09:31:34 +0000 (20:31 +1100)]
Fix clang nits.

7 years agoUse int over size_t.
Emil Mikulic [Sat, 15 Jan 2011 09:22:52 +0000 (20:22 +1100)]
Use int over size_t.

7 years agoDon't use init decls, they're C99.
Emil Mikulic [Sat, 15 Jan 2011 09:13:00 +0000 (20:13 +1100)]
Don't use init decls, they're C99.

7 years agoFinished style changes.
Emil Mikulic [Sat, 15 Jan 2011 09:12:12 +0000 (20:12 +1100)]
Finished style changes.

7 years agoMore style changes, fixed most of the compiler warnings.
Emil Mikulic [Sat, 15 Jan 2011 09:08:16 +0000 (20:08 +1100)]
More style changes, fixed most of the compiler warnings.

7 years agoMore style changes, move a function.
Emil Mikulic [Sat, 15 Jan 2011 08:36:09 +0000 (19:36 +1100)]
More style changes, move a function.

7 years agoMostly style changes.
Emil Mikulic [Sat, 15 Jan 2011 08:17:03 +0000 (19:17 +1100)]
Mostly style changes.

7 years agoRestyle and add printflike.
Emil Mikulic [Sat, 15 Jan 2011 07:37:15 +0000 (18:37 +1100)]
Restyle and add printflike.

7 years agoBump copyright year.
Emil Mikulic [Sat, 15 Jan 2011 07:16:12 +0000 (18:16 +1100)]
Bump copyright year.

7 years agoMore inttype tweaks.
Emil Mikulic [Sat, 15 Jan 2011 07:15:39 +0000 (18:15 +1100)]
More inttype tweaks.

7 years agoCasts and indents.
Emil Mikulic [Sat, 15 Jan 2011 05:20:09 +0000 (16:20 +1100)]
Casts and indents.

7 years agoCosmetics.
Emil Mikulic [Sat, 15 Jan 2011 05:16:22 +0000 (16:16 +1100)]
Cosmetics.

7 years agoAvoid infinite loop (and quiet gcc warning)
Emil Mikulic [Sat, 15 Jan 2011 05:06:31 +0000 (16:06 +1100)]
Avoid infinite loop (and quiet gcc warning)

7 years agoRanges work now.
Emil Mikulic [Wed, 24 Nov 2010 14:49:23 +0000 (01:49 +1100)]
Ranges work now.

7 years agoShould these be unsigned?
Emil Mikulic [Wed, 24 Nov 2010 14:44:46 +0000 (01:44 +1100)]
Should these be unsigned?

7 years agoMore longlong fixes.
Emil Mikulic [Wed, 24 Nov 2010 14:43:51 +0000 (01:43 +1100)]
More longlong fixes.

10 years agoWorking on large file support.
Emil Mikulic [Wed, 24 Nov 2010 14:37:37 +0000 (01:37 +1100)]
Working on large file support.

10 years agoTidy up Makefile.
Emil Mikulic [Wed, 24 Nov 2010 12:33:31 +0000 (23:33 +1100)]
Tidy up Makefile.

7 years agoMove trunk/ into base dir, move tests into devel/.
Emil Mikulic [Sun, 28 Apr 2013 10:29:15 +0000 (20:29 +1000)]
Move trunk/ into base dir, move tests into devel/.

7 years ago[ darkhttpd-1.7 release ]
Emil Mikulic [Sat, 1 Nov 2008 14:47:33 +0000 (14:47 +0000)]
[ darkhttpd-1.7 release ]

7 years agoFix off-by-one.
Emil Mikulic [Tue, 4 Nov 2008 08:53:22 +0000 (08:53 +0000)]
Fix off-by-one.

7 years agoDon't use strlen() in urlencode_filename()
Emil Mikulic [Sun, 26 Oct 2008 12:53:34 +0000 (12:53 +0000)]
Don't use strlen() in urlencode_filename()

Also move safe_url variable into for loop that uses it.

7 years agois_bad_char -> needs_urlencoding, whitespace fixes.
Emil Mikulic [Sun, 26 Oct 2008 12:50:28 +0000 (12:50 +0000)]
is_bad_char -> needs_urlencoding, whitespace fixes.

7 years agourlencode file names when generating directory listing.
Emil Mikulic [Sun, 26 Oct 2008 12:45:57 +0000 (12:45 +0000)]
urlencode file names when generating directory listing.

Noticed by, patched by: nf

7 years ago[ darkhttpd-1.6 release ]
Emil Mikulic [Sat, 2 Aug 2008 04:00:56 +0000 (04:00 +0000)]
[ darkhttpd-1.6 release ]

Update copyright years.

7 years agoUbuntu hides uname somewhere else. Don't use a full path.
Emil Mikulic [Sat, 2 Aug 2008 03:59:02 +0000 (03:59 +0000)]
Ubuntu hides uname somewhere else.  Don't use a full path.

7 years agoFive-letter patch that fixes a use-after-free and possible list
Emil Mikulic [Sat, 2 Aug 2008 03:51:11 +0000 (03:51 +0000)]
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.

7 years ago[ darkhttpd-1.5 release ]
Emil Mikulic [Thu, 14 Dec 2006 10:13:55 +0000 (10:13 +0000)]
[ darkhttpd-1.5 release ]

(we skipped 1.4 due to a release engineering oversight)

Update README to reflect Makefile changes.

7 years agoSimplify the Makefile.
Emil Mikulic [Thu, 14 Dec 2006 10:10:46 +0000 (10:10 +0000)]
Simplify the Makefile.

7 years agoNot sure if we were taking the size of the right thing previously.
Emil Mikulic [Thu, 14 Dec 2006 10:08:34 +0000 (10:08 +0000)]
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.

7 years agoRevert - don't bother with tzset.
Emil Mikulic [Thu, 14 Dec 2006 10:05:06 +0000 (10:05 +0000)]
Revert - don't bother with tzset.

7 years agoStuff to do when I find the time.
Emil Mikulic [Wed, 13 Dec 2006 14:00:24 +0000 (14:00 +0000)]
Stuff to do when I find the time.

7 years agoIf sendfile blocks and sends zero bytes, treat it as blocking and not
Emil Mikulic [Wed, 13 Dec 2006 13:55:48 +0000 (13:55 +0000)]
If sendfile blocks and sends zero bytes, treat it as blocking and not
end-of-file.  This is a really rare corner case.

7 years agoCache time and update it once per event loop iteration.
Emil Mikulic [Wed, 13 Dec 2006 13:38:50 +0000 (13:38 +0000)]
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.

7 years agoSlightly re-arrange the way recycling of keep-alive connections is
Emil Mikulic [Wed, 13 Dec 2006 13:32:22 +0000 (13:32 +0000)]
Slightly re-arrange the way recycling of keep-alive connections is
handled.  Unfortunately, I'm still seeing horrible performance.

7 years agoMinor tweaks.
Emil Mikulic [Wed, 13 Dec 2006 13:28:32 +0000 (13:28 +0000)]
Minor tweaks.

7 years agoImplement disabling TCP_NODELAY, but comment it out.
Emil Mikulic [Wed, 13 Dec 2006 13:28:10 +0000 (13:28 +0000)]
Implement disabling TCP_NODELAY, but comment it out.

It makes performance worse.

7 years agoWe can handle a request from accept() to close() without having to go through a
Emil Mikulic [Wed, 13 Dec 2006 13:07:10 +0000 (13:07 +0000)]
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.

7 years agoCall tzset() during initialization.
Emil Mikulic [Wed, 13 Dec 2006 13:01:41 +0000 (13:01 +0000)]
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.  =(

7 years agoAnother state transition optimization:
Emil Mikulic [Wed, 13 Dec 2006 12:57:30 +0000 (12:57 +0000)]
Another state transition optimization:
Go from send_header straight to send_reply.

7 years agoAnother state transition optimization due to NBIO:
Emil Mikulic [Wed, 13 Dec 2006 12:47:20 +0000 (12:47 +0000)]
Another state transition optimization due to NBIO:
Go from recv_request to send_header without visiting select()

7 years agoAfter accepting a connection, attempt a read straight away instead of
Emil Mikulic [Wed, 13 Dec 2006 12:41:08 +0000 (12:41 +0000)]
After accepting a connection, attempt a read straight away instead of
going through an iteration of the select() loop.

7 years agoDon't just SETFL O_NONBLOCK, first GETFL.
Emil Mikulic [Wed, 13 Dec 2006 12:31:30 +0000 (12:31 +0000)]
Don't just SETFL O_NONBLOCK, first GETFL.

7 years ago%Z gives UTC. Apache uses GMT instead, and wget complains about an
Emil Mikulic [Wed, 13 Dec 2006 11:53:13 +0000 (11:53 +0000)]
%Z gives UTC.  Apache uses GMT instead, and wget complains about an
invalid header when it sees UTC, so switch.

7 years agoGet the constness right.
Emil Mikulic [Wed, 13 Dec 2006 08:41:05 +0000 (08:41 +0000)]
Get the constness right.

7 years ago- In decode_url()
Emil Mikulic [Wed, 13 Dec 2006 08:38:18 +0000 (08:38 +0000)]
- 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!

7 years agoRestore a check I shouldn't have removed.
Emil Mikulic [Wed, 13 Dec 2006 08:32:10 +0000 (08:32 +0000)]
Restore a check I shouldn't have removed.
We now pass all our tests again.

7 years agoAdapt make_safe_uri() to work in-place.
Emil Mikulic [Wed, 13 Dec 2006 08:30:21 +0000 (08:30 +0000)]
Adapt make_safe_uri() to work in-place.
We're currently failing some tests.

7 years agoTurn up the debugging and warnflags.
Emil Mikulic [Wed, 13 Dec 2006 08:29:53 +0000 (08:29 +0000)]
Turn up the debugging and warnflags.

7 years agoTest for consolidate_slashes() too.
Emil Mikulic [Wed, 13 Dec 2006 08:17:56 +0000 (08:17 +0000)]
Test for consolidate_slashes() too.

7 years agoRemember to free memory.
Emil Mikulic [Wed, 13 Dec 2006 08:16:16 +0000 (08:16 +0000)]
Remember to free memory.

7 years agoAdd tests for make_safe_uri.
Emil Mikulic [Wed, 13 Dec 2006 08:14:27 +0000 (08:14 +0000)]
Add tests for make_safe_uri.

7 years agoRename warnflags to debug-build and add debugging and torture defines.
Emil Mikulic [Wed, 13 Dec 2006 07:46:46 +0000 (07:46 +0000)]
Rename warnflags to debug-build and add debugging and torture defines.

7 years agoRequest a bigger file -> more testing.
Emil Mikulic [Wed, 13 Dec 2006 07:46:26 +0000 (07:46 +0000)]
Request a bigger file -> more testing.

7 years agoTorture test: send and recv one byte at a time to make sure darkhttpd's
Emil Mikulic [Wed, 13 Dec 2006 07:35:52 +0000 (07:35 +0000)]
Torture test: send and recv one byte at a time to make sure darkhttpd's
buffering is up to scratch.

7 years agoImplement (optional, compile-time) shrinking of send buffer for torture tests.
Emil Mikulic [Wed, 13 Dec 2006 07:35:29 +0000 (07:35 +0000)]
Implement (optional, compile-time) shrinking of send buffer for torture tests.

7 years agoRemove the pidfile_path assertion entirely.
Emil Mikulic [Wed, 13 Dec 2006 07:23:55 +0000 (07:23 +0000)]
Remove the pidfile_path assertion entirely.

Its name changed but I didn't notice because I didn't do any DEBUG builds.

7 years agoFix some GCC warnings.
Emil Mikulic [Wed, 13 Dec 2006 07:16:38 +0000 (07:16 +0000)]
Fix some GCC warnings.

Pointed out by: Brian Lewis <bsl04@uark.edu>
Pointed out on: Wed, 27 Sep 2006 15:46:26 -0500

7 years agoNeed some release engineering reminders after I failed to update the pkgname
Emil Mikulic [Wed, 13 Dec 2006 07:15:32 +0000 (07:15 +0000)]
Need some release engineering reminders after I failed to update the pkgname
when I released v1.4.

7 years agoWalking through the code - correct some comment typos.
Emil Mikulic [Wed, 13 Dec 2006 07:09:10 +0000 (07:09 +0000)]
Walking through the code - correct some comment typos.

7 years ago[ darkhttpd-1.4 release ]
Emil Mikulic [Mon, 4 Sep 2006 07:04:39 +0000 (07:04 +0000)]
[ darkhttpd-1.4 release ]

Fix a segfault in log_connection() that happens when the incoming
request is too long.

(Forgot to bump the version)

7 years ago[ darkhttpd-1.3 release ]
Emil Mikulic [Fri, 21 Jul 2006 09:33:55 +0000 (09:33 +0000)]
[ darkhttpd-1.3 release ]

Also remove an unused variable.

7 years agoDon't need libutil anymore.
Emil Mikulic [Fri, 21 Jul 2006 09:33:10 +0000 (09:33 +0000)]
Don't need libutil anymore.

7 years agoAdd example of --dameon and --pidfile to README.
Emil Mikulic [Fri, 21 Jul 2006 09:24:47 +0000 (09:24 +0000)]
Add example of --dameon and --pidfile to README.

7 years agoImport pidfile helpers and cut them down to just the pieces we need.
Emil Mikulic [Fri, 21 Jul 2006 09:17:34 +0000 (09:17 +0000)]
Import pidfile helpers and cut them down to just the pieces we need.

7 years agoImplement warn()
Emil Mikulic [Fri, 21 Jul 2006 08:43:09 +0000 (08:43 +0000)]
Implement warn()

7 years agoImplement daemonize.
Emil Mikulic [Fri, 21 Jul 2006 08:39:01 +0000 (08:39 +0000)]
Implement daemonize.

7 years agoAdd mimetypes, sort them, remove lots of whitespace from the middle.
Emil Mikulic [Fri, 21 Jul 2006 08:16:30 +0000 (08:16 +0000)]
Add mimetypes, sort them, remove lots of whitespace from the middle.

7 years agoUpdate copyright years.
Emil Mikulic [Fri, 21 Jul 2006 07:26:13 +0000 (07:26 +0000)]
Update copyright years.

7 years agoWe need libutil on BSD now.
Emil Mikulic [Fri, 21 Jul 2006 07:17:24 +0000 (07:17 +0000)]
We need libutil on BSD now.

7 years agoYou don't "usually" need root privs for chroot(), you always do.
Emil Mikulic [Fri, 21 Jul 2006 07:17:04 +0000 (07:17 +0000)]
You don't "usually" need root privs for chroot(), you always do.

7 years agoImplement --pidfile and move clean shutdown into main()
Emil Mikulic [Fri, 21 Jul 2006 07:14:22 +0000 (07:14 +0000)]
Implement --pidfile and move clean shutdown into main()

7 years agoFix build on FreeBSD by spelling "sockin" correctly.
Emil Mikulic [Fri, 21 Jul 2006 07:13:21 +0000 (07:13 +0000)]
Fix build on FreeBSD by spelling "sockin" correctly.
This has been outstanding for a long time.

7 years agoAnswer requests that end in \n\n as well as the more pedantic \r\n\r\n
Emil Mikulic [Fri, 21 Jul 2006 07:12:46 +0000 (07:12 +0000)]
Answer requests that end in \n\n as well as the more pedantic \r\n\r\n

7 years agoAdd support for sendfile() on Solaris.
Emil Mikulic [Fri, 21 Jul 2006 07:11:56 +0000 (07:11 +0000)]
Add support for sendfile() on Solaris.

7 years agoFix fallback on platforms that don't have sendfile()
Emil Mikulic [Fri, 21 Jul 2006 07:11:08 +0000 (07:11 +0000)]
Fix fallback on platforms that don't have sendfile()
It was quite badly broken.

7 years ago[ darkhttpd-1.2 release ]
Emil Mikulic [Mon, 27 Dec 2004 12:54:54 +0000 (12:54 +0000)]
[ darkhttpd-1.2 release ]

7 years agoInstructions, not prompts.
Emil Mikulic [Mon, 27 Dec 2004 12:49:08 +0000 (12:49 +0000)]
Instructions, not prompts.

7 years agoFix (unsigned < 0) comparison.
Emil Mikulic [Mon, 27 Dec 2004 12:48:24 +0000 (12:48 +0000)]
Fix (unsigned < 0) comparison.

7 years agosafefree -> free
Emil Mikulic [Mon, 27 Dec 2004 12:47:39 +0000 (12:47 +0000)]
safefree -> free

7 years agoFix debugf mess.
Emil Mikulic [Mon, 27 Dec 2004 12:46:35 +0000 (12:46 +0000)]
Fix debugf mess.

7 years agoFix signed-unsigned comparison.
Emil Mikulic [Mon, 27 Dec 2004 12:40:43 +0000 (12:40 +0000)]
Fix signed-unsigned comparison.

7 years agoManually inline acceptfilter code to remove unused arg warning on
Emil Mikulic [Mon, 27 Dec 2004 12:38:32 +0000 (12:38 +0000)]
Manually inline acceptfilter code to remove unused arg warning on
non-FreeBSD platforms.

7 years agoFix err and debugf warnings.
Emil Mikulic [Mon, 27 Dec 2004 12:30:36 +0000 (12:30 +0000)]
Fix err and debugf warnings.

7 years agoAdjust copyright and license.
Emil Mikulic [Mon, 27 Dec 2004 12:28:46 +0000 (12:28 +0000)]
Adjust copyright and license.

7 years agoTrack requests and bytes transferred statistics.
Emil Mikulic [Sun, 14 Dec 2003 08:29:08 +0000 (08:29 +0000)]
Track requests and bytes transferred statistics.

7 years ago[ darkhttpd-1.1 release ]
Emil Mikulic [Sat, 13 Dec 2003 14:19:06 +0000 (14:19 +0000)]
[ darkhttpd-1.1 release ]

Make the Makefile work with Solaris make(1S)

7 years agowwwroot = strdup(argv[1]) so we don't end up stripping the only existing
Emil Mikulic [Sat, 13 Dec 2003 14:11:49 +0000 (14:11 +0000)]
wwwroot = strdup(argv[1]) so we don't end up stripping the only existing
slash out of the commandline shown by ps(1).  And free it on shutdown.

7 years ago. Tell people to use Makefile for building.
Emil Mikulic [Sat, 13 Dec 2003 14:09:05 +0000 (14:09 +0000)]
. Tell people to use Makefile for building.
. Make a few things clearer by improving examples.

7 years agoUser specifies platform, like mpg123.
Emil Mikulic [Sat, 13 Dec 2003 14:08:36 +0000 (14:08 +0000)]
User specifies platform, like mpg123.

7 years ago. Split usage() into many printfs() to keep GCC3 happy about ISO limits.
Emil Mikulic [Sat, 13 Dec 2003 08:56:05 +0000 (08:56 +0000)]
. Split usage() into many printfs() to keep GCC3 happy about ISO limits.
. Knock out the REPLY_GENERATED length assertion since ap_buf doesn't
  null-terminate strings and it's never been tripped by xasprintf()
  consumers.
. Cast rusage times when printing, and don't print too many zeroes.

7 years agoOptimize generate_dir_listing():
Emil Mikulic [Sat, 13 Dec 2003 08:45:06 +0000 (08:45 +0000)]
Optimize generate_dir_listing():
. Split appendf() calls into a number of append() calls.
. To insert spaces, instead of sitting in a loop, use a spaces[] buffer
  and insert a chunk of it with appendl().

7 years ago. Version upped to 1.1 for append buffer optimizations.
Emil Mikulic [Sat, 13 Dec 2003 08:42:34 +0000 (08:42 +0000)]
. Version upped to 1.1 for append buffer optimizations.
. Don't keep the apbuf strings null-terminated.
. Compile-time optimise append() if we have GCC.

7 years agoBefore exiting, getrusage() and print time spent on CPU.
Emil Mikulic [Sat, 13 Dec 2003 07:50:16 +0000 (07:50 +0000)]
Before exiting, getrusage() and print time spent on CPU.

7 years agoMerge two lines.
Emil Mikulic [Sat, 13 Dec 2003 07:37:52 +0000 (07:37 +0000)]
Merge two lines.