darkhttpd
4 months agoAvoid file size overflow on 32-bit systems. master
Emil Mikulic [Wed, 1 Jul 2020 12:07:12 +0000 (22:07 +1000)]
Avoid file size overflow on 32-bit systems.

Reported by: Mariusz Stokłosa <krokator@gmail.com>

4 months agoLog using Combined Log Format (commonly found in apache log)
solsTiCe d'Hiver [Mon, 27 Nov 2017 19:10:02 +0000 (20:10 +0100)]
Log using Combined Log Format (commonly found in apache log)

Commonly found in Apache log. It adds 2 fields upon the Common Log
Format (referer and user-agent).

https://en.wikipedia.org/wiki/Common_Log_Format

It is just a matter of reordering what your were already logging with a
new date formatting.

* We are cheating because we always assume HTTP/1.1 as the request
  header.

* We assume the user name is unknown.

4 months agoadd mp4 mine type
Andreas Gal [Sun, 19 Feb 2012 19:57:37 +0000 (20:57 +0100)]
add mp4 mine type

4 months agoHonour LDFLAGS.
Christian Hesse [Tue, 28 Nov 2017 22:28:33 +0000 (23:28 +0100)]
Honour LDFLAGS.

Signed-off-by: Christian Hesse <mail@eworm.de>
4 months agoAdd SVG mime type.
Teo Klestrup Röijezon [Mon, 26 Feb 2018 14:49:24 +0000 (15:49 +0100)]
Add SVG mime type.

4 months agoDon't send extra blank line when --auth is disabled.
Emil Mikulic [Wed, 1 Jul 2020 11:04:17 +0000 (21:04 +1000)]
Don't send extra blank line when --auth is disabled.

4 months agoAdd tests for --auth.
Emil Mikulic [Wed, 1 Jul 2020 11:00:46 +0000 (21:00 +1000)]
Add tests for --auth.

4 months agoAdd basic-auth support.
Ryan Jacobs [Sat, 4 May 2019 00:43:42 +0000 (17:43 -0700)]
Add basic-auth support.

4 months ago-fno-omit-frame-pointer to get full backtraces in asan build.
Emil Mikulic [Wed, 1 Jul 2020 10:46:10 +0000 (20:46 +1000)]
-fno-omit-frame-pointer to get full backtraces in asan build.

4 months agoEnable leak sanitizer.
Emil Mikulic [Wed, 1 Jul 2020 10:43:49 +0000 (20:43 +1000)]
Enable leak sanitizer.

4 months agoSilence -Wparentheses warning.
Emil Mikulic [Wed, 1 Jul 2020 10:15:27 +0000 (20:15 +1000)]
Silence -Wparentheses warning.

4 months agoAdjust test: make_safe_uri no longer strips query params.
Emil Mikulic [Wed, 1 Jul 2020 10:11:25 +0000 (20:11 +1000)]
Adjust test: make_safe_uri no longer strips query params.

4 months agoFix handling of files with question mark in the name.
Mathieu Gagnon [Sat, 11 Jan 2020 00:52:28 +0000 (19:52 -0500)]
Fix handling of files with question mark in the name.

4 months agoAdd tests for fetching a file with a question mark in its name.
Emil Mikulic [Wed, 1 Jul 2020 10:01:56 +0000 (20:01 +1000)]
Add tests for fetching a file with a question mark in its name.

4 months agoTweak macros to avoid extraneous semicolons.
Emil Mikulic [Wed, 1 Jul 2020 09:43:30 +0000 (19:43 +1000)]
Tweak macros to avoid extraneous semicolons.

-Wextra-semi-stmt complains about this.

4 months agoclang-warns: use clang in path by default.
Emil Mikulic [Wed, 1 Jul 2020 09:41:46 +0000 (19:41 +1000)]
clang-warns: use clang in path by default.

4 months agoMemory sanitizer workaround: unpoison fd_sets.
Emil Mikulic [Wed, 1 Jul 2020 09:18:13 +0000 (19:18 +1000)]
Memory sanitizer workaround: unpoison fd_sets.

This is necessary with clang-9, maybe earlier.

4 months agoAdd application/wasm mimetype
Luca Weiss [Tue, 30 Jun 2020 17:27:43 +0000 (19:27 +0200)]
Add application/wasm mimetype

Useful for serving wasm files.

See https://github.com/ruffle-rs/ruffle/wiki/Using-Ruffle#configure-wasm-mime-type

23 months agoAdd benchmark.
Emil Mikulic [Mon, 10 Dec 2018 13:42:52 +0000 (00:42 +1100)]
Add benchmark.

23 months agoAdd test for --timeout.
Emil Mikulic [Mon, 10 Dec 2018 12:52:42 +0000 (23:52 +1100)]
Add test for --timeout.

23 months agoAdd --timeout cmdline option.
Emil Mikulic [Mon, 10 Dec 2018 12:33:13 +0000 (23:33 +1100)]
Add --timeout cmdline option.

23 months agorun-tests: try to use the default gcc and clang.
Emil Mikulic [Mon, 10 Dec 2018 10:12:24 +0000 (21:12 +1100)]
run-tests: try to use the default gcc and clang.

23 months agorun-tests: don't mix msan with ubsan.
Emil Mikulic [Mon, 10 Dec 2018 10:02:46 +0000 (21:02 +1100)]
run-tests: don't mix msan with ubsan.

ubsan seems to be causing false positives for msan.
We already try ubsan together with asan.

23 months agoClean more.
Emil Mikulic [Mon, 10 Dec 2018 09:36:07 +0000 (20:36 +1100)]
Clean more.

23 months agoBump copyright year.
Emil Mikulic [Sun, 9 Dec 2018 14:11:55 +0000 (01:11 +1100)]
Bump copyright year.

23 months agoopen_sockets: finer grained timing.
Emil Mikulic [Sun, 9 Dec 2018 14:10:06 +0000 (01:10 +1100)]
open_sockets: finer grained timing.

23 months agoIn debug mode: time how long select() takes.
Emil Mikulic [Sun, 9 Dec 2018 14:09:33 +0000 (01:09 +1100)]
In debug mode: time how long select() takes.

23 months agoFix timeouts to close connections.
Emil Mikulic [Sun, 9 Dec 2018 13:54:12 +0000 (00:54 +1100)]
Fix timeouts to close connections.

23 months agoAdd helper script for opening sockets until they run out.
Emil Mikulic [Sun, 9 Dec 2018 13:30:31 +0000 (00:30 +1100)]
Add helper script for opening sockets until they run out.

23 months agoIf accept() fails, don't exit.
Emil Mikulic [Sun, 9 Dec 2018 12:49:43 +0000 (23:49 +1100)]
If accept() fails, don't exit.

Temporarily stop accept()ing if we ran out of fds.

Suggested by: Bert Gijsbers

23 months agoSwitch make_safe_url() to more efficient implementation.
Emil Mikulic [Sun, 9 Dec 2018 12:18:00 +0000 (23:18 +1100)]
Switch make_safe_url() to more efficient implementation.

Contributed by: Bert Gijsbers

23 months agoAdd make_safe_url_new()
Emil Mikulic [Sun, 9 Dec 2018 12:13:28 +0000 (23:13 +1100)]
Add make_safe_url_new()

Contributed by: Bert Gijsbers

23 months agoAdd LLVM fuzzer.
Emil Mikulic [Fri, 2 Sep 2016 09:20:12 +0000 (19:20 +1000)]
Add LLVM fuzzer.

23 months agoBounds check first.
Emil Mikulic [Tue, 21 Aug 2018 15:14:17 +0000 (01:14 +1000)]
Bounds check first.

Found with: cppcheck

4 years ago[ darkhttpd 1.12 release ]
Emil Mikulic [Wed, 27 Jan 2016 14:16:10 +0000 (01:16 +1100)]
[ darkhttpd 1.12 release ]

4 years agoBuild with warnings.
Emil Mikulic [Wed, 27 Jan 2016 14:05:27 +0000 (01:05 +1100)]
Build with warnings.

4 years agoFix IPv6 memory corruption crash on FreeBSD.
Emil Mikulic [Wed, 27 Jan 2016 14:03:38 +0000 (01:03 +1100)]
Fix IPv6 memory corruption crash on FreeBSD.

getsockname() into addrin6 instead of addrin when ipv6 is requested.

4 years agoRun tests under msan.
Emil Mikulic [Wed, 27 Jan 2016 13:41:34 +0000 (00:41 +1100)]
Run tests under msan.

4 years agoAdd asan and ubsan to tests, watch stderr.
Emil Mikulic [Sun, 24 Jan 2016 05:39:32 +0000 (16:39 +1100)]
Add asan and ubsan to tests, watch stderr.

4 years agoObvious %lld -> %llu correction.
Emil Mikulic [Sat, 23 Jan 2016 09:13:17 +0000 (20:13 +1100)]
Obvious %lld -> %llu correction.

Caught with cppcheck.
I have no idea why it wasn't caught earlier.

4 years agoAdd Makefile for tests and cleaning up.
Emil Mikulic [Sat, 23 Jan 2016 09:11:30 +0000 (20:11 +1100)]
Add Makefile for tests and cleaning up.

4 years agoMake the output more obvious.
Emil Mikulic [Sat, 23 Jan 2016 09:10:10 +0000 (20:10 +1100)]
Make the output more obvious.

4 years agoTest builds with different defines.
Emil Mikulic [Sat, 23 Jan 2016 09:08:02 +0000 (20:08 +1100)]
Test builds with different defines.

4 years agoRename "cover" to "run-tests"
Emil Mikulic [Sat, 23 Jan 2016 09:05:02 +0000 (20:05 +1100)]
Rename "cover" to "run-tests"

4 years agoBe explicit if the binary was built without IPV6 support.
Emil Mikulic [Sat, 23 Jan 2016 08:57:23 +0000 (19:57 +1100)]
Be explicit if the binary was built without IPV6 support.

Fix the number of newlines involved.

4 years agoTry to build with IPv6 by default.
Emil Mikulic [Sat, 23 Jan 2016 08:55:33 +0000 (19:55 +1100)]
Try to build with IPv6 by default.

4 years agoBump copyright year.
Emil Mikulic [Sat, 23 Jan 2016 08:51:37 +0000 (19:51 +1100)]
Bump copyright year.

4 years agoCatch up to clang changes.
Emil Mikulic [Wed, 13 Jan 2016 13:57:42 +0000 (00:57 +1100)]
Catch up to clang changes.

4 years agoMove HAVE_INET6 guards to avoid the appearance of functions that don't return.
Emil Mikulic [Wed, 13 Jan 2016 09:24:36 +0000 (20:24 +1100)]
Move HAVE_INET6 guards to avoid the appearance of functions that don't return.

Fixes GCC warnings.

4 years agoExplicitly cast getpid() result to int.
Emil Mikulic [Wed, 13 Jan 2016 09:18:30 +0000 (20:18 +1100)]
Explicitly cast getpid() result to int.

This placates cppcheck.

4 years agoTidy up UTF-8 after merge.
Emil Mikulic [Wed, 13 Jan 2016 09:04:29 +0000 (20:04 +1100)]
Tidy up UTF-8 after merge.

4 years agoMerge branches with UTF-8 changes.
Emil Mikulic [Wed, 13 Jan 2016 09:00:44 +0000 (20:00 +1100)]
Merge branches with UTF-8 changes.

4 years agoI added utf-8 in your code: "Content-Type: text/html; charset=utf-8\r\n"
Alexey [Wed, 13 Jan 2016 08:46:31 +0000 (19:46 +1100)]
I added utf-8 in your code: "Content-Type: text/html; charset=utf-8\r\n"

(in few places)

4 years agoAdd '<meta charset="utf-8"/>' to the html header
Stephen Zhang [Mon, 28 Dec 2015 06:41:54 +0000 (14:41 +0800)]
Add '<meta charset="utf-8"/>' to the html header

I think most non-English user would need it to fix error encoding in displaying
file name in the web page.

4 years agoUse UTF-8 as the encoding for directory listing.
Hugh Wang [Sun, 20 Dec 2015 14:49:14 +0000 (22:49 +0800)]
Use UTF-8 as the encoding for directory listing.

4 years agoIndent, add dir, allow inconclusive.
Emil Mikulic [Sun, 10 Jan 2016 13:31:58 +0000 (00:31 +1100)]
Indent, add dir, allow inconclusive.

4 years agoAdd support for IPv6.
Hugh Wang [Sun, 20 Dec 2015 13:59:20 +0000 (21:59 +0800)]
Add support for IPv6.

5 years agoCheck the bound first.
Emil Mikulic [Tue, 19 May 2015 14:06:59 +0000 (00:06 +1000)]
Check the bound first.

Found with cppcheck.

5 years agoEscape URLs according to RFC3986.
Emil Mikulic [Tue, 19 May 2015 12:02:12 +0000 (22:02 +1000)]
Escape URLs according to RFC3986.

Previously, we weren't escaping parentheses when generating directory listings.

Pointed out by: Wijatmoko U. Prayitno

5 years agoAdd --default-mimetype flag.
Emil Mikulic [Tue, 19 May 2015 11:40:26 +0000 (21:40 +1000)]
Add --default-mimetype flag.

5 years agoAdd test for --no-listing.
Emil Mikulic [Tue, 19 May 2015 11:23:14 +0000 (21:23 +1000)]
Add test for --no-listing.

5 years agoFix memory leak.
Emil Mikulic [Tue, 19 May 2015 11:17:42 +0000 (21:17 +1000)]
Fix memory leak.

5 years agomention --forward-all in help output
Christian Hesse [Mon, 18 May 2015 22:43:42 +0000 (00:43 +0200)]
mention --forward-all in help output

Signed-off-by: Christian Hesse <mail@eworm.de>
5 years agoadd option to deny directory listing
Christian Hesse [Mon, 18 May 2015 22:43:41 +0000 (00:43 +0200)]
add option to deny directory listing

Signed-off-by: Christian Hesse <mail@eworm.de>
5 years ago[ darkhttpd 1.11 release ]
Emil Mikulic [Thu, 1 Jan 2015 11:42:44 +0000 (22:42 +1100)]
[ darkhttpd 1.11 release ]

5 years agoRemove unused var, add casts to str_to_num() calls.
Emil Mikulic [Thu, 1 Jan 2015 11:41:35 +0000 (22:41 +1100)]
Remove unused var, add casts to str_to_num() calls.

5 years agoCall setgroups() before setgid() to drop supplementary groups.
Emil Mikulic [Thu, 1 Jan 2015 11:22:41 +0000 (22:22 +1100)]
Call setgroups() before setgid() to drop supplementary groups.

See also: https://www.securecoding.cert.org/confluence/display/seccode/POS36-C.+Observe+correct+revocation+order+while+relinquishing+privileges

5 years agoTest keepalive.
Emil Mikulic [Thu, 1 Jan 2015 11:18:10 +0000 (22:18 +1100)]
Test keepalive.

5 years agoAdd TestHelper.get()
Emil Mikulic [Thu, 1 Jan 2015 10:47:59 +0000 (21:47 +1100)]
Add TestHelper.get()

5 years agoTest for unreadable directory (can't generate listing).
Emil Mikulic [Thu, 1 Jan 2015 10:20:08 +0000 (21:20 +1100)]
Test for unreadable directory (can't generate listing).

5 years agoMake str_to_num() check for ERANGE, use it instead of atoi().
Emil Mikulic [Thu, 1 Jan 2015 10:00:57 +0000 (21:00 +1100)]
Make str_to_num() check for ERANGE, use it instead of atoi().

5 years agochomp() isn't needed because read_line() strips [cr]lf.
Emil Mikulic [Thu, 1 Jan 2015 09:38:38 +0000 (20:38 +1100)]
chomp() isn't needed because read_line() strips [cr]lf.

5 years agoTest resize in appendl().
Emil Mikulic [Thu, 1 Jan 2015 09:35:37 +0000 (20:35 +1100)]
Test resize in appendl().

5 years agoTest 404 and 403.
Emil Mikulic [Thu, 1 Jan 2015 09:32:52 +0000 (20:32 +1100)]
Test 404 and 403.

5 years agoTest CRLF handling in read_line().
Emil Mikulic [Thu, 1 Jan 2015 09:16:47 +0000 (20:16 +1100)]
Test CRLF handling in read_line().

5 years agoWhen testing, build with -DDEBUG.
Emil Mikulic [Thu, 1 Jan 2015 07:32:01 +0000 (18:32 +1100)]
When testing, build with -DDEBUG.

5 years agoZero slashes should be impossible here.
Emil Mikulic [Thu, 1 Jan 2015 07:26:35 +0000 (18:26 +1100)]
Zero slashes should be impossible here.

5 years agoAdd a harness for fuzzing make_safe_uri()
Emil Mikulic [Thu, 1 Jan 2015 07:14:28 +0000 (18:14 +1100)]
Add a harness for fuzzing make_safe_uri()

5 years agocp test_make_safe_uri.c fuzz_make_safe_uri.c
Emil Mikulic [Thu, 1 Jan 2015 06:10:47 +0000 (17:10 +1100)]
cp test_make_safe_uri.c fuzz_make_safe_uri.c

6 years ago[ darkhttpd 1.10 release ]
Emil Mikulic [Mon, 26 May 2014 12:07:59 +0000 (22:07 +1000)]
[ darkhttpd 1.10 release ]

6 years agoAdd test for urldecode()
Emil Mikulic [Mon, 26 May 2014 12:01:22 +0000 (22:01 +1000)]
Add test for urldecode()

6 years agoprintf [s]size_t as %z[du].
Emil Mikulic [Mon, 26 May 2014 11:56:45 +0000 (21:56 +1000)]
printf [s]size_t as %z[du].

6 years agocppcheck: use --force to check all #ifdef configurations.
Emil Mikulic [Mon, 26 May 2014 11:56:29 +0000 (21:56 +1000)]
cppcheck: use --force to check all #ifdef configurations.

6 years agoRemove query params.
Emil Mikulic [Mon, 26 May 2014 11:36:29 +0000 (21:36 +1000)]
Remove query params.

Reported by: James Antill
https://bugzilla.redhat.com/show_bug.cgi?id=1099199

6 years agoMark cppcheck executable.
Emil Mikulic [Fri, 14 Mar 2014 11:51:43 +0000 (22:51 +1100)]
Mark cppcheck executable.

6 years agoRun test_make_safe_uri. Retire broken run-tests.sh
Emil Mikulic [Fri, 14 Mar 2014 11:50:44 +0000 (22:50 +1100)]
Run test_make_safe_uri.  Retire broken run-tests.sh

6 years agoSilence warning about unused arg.
Emil Mikulic [Fri, 14 Mar 2014 11:45:39 +0000 (22:45 +1100)]
Silence warning about unused arg.

6 years agoRetab README. No content changes.
Emil Mikulic [Fri, 14 Mar 2014 11:43:46 +0000 (22:43 +1100)]
Retab README.  No content changes.

6 years agoAdd .gitignore.
Christian Hesse [Thu, 2 May 2013 11:47:59 +0000 (13:47 +0200)]
Add .gitignore.

Stop git complaining about untracked file darkhttpd.

6 years agoImplement --forward-all to forward all requests to a given url.
Emil Mikulic [Fri, 14 Mar 2014 11:36:37 +0000 (22:36 +1100)]
Implement --forward-all to forward all requests to a given url.

Suggested and initially implemented by: Christian Hesse <mail@eworm.de>

6 years agontohs() when reporting the port number.
Emil Mikulic [Fri, 14 Mar 2014 11:12:25 +0000 (22:12 +1100)]
ntohs() when reporting the port number.

Re-use addrin when fetching the port number.

6 years agoexit cleanly for `--help`
Lukas Stabe [Wed, 5 Feb 2014 22:49:09 +0000 (23:49 +0100)]
exit cleanly for `--help`

6 years agodocument port 0 == random available
Lukas Stabe [Wed, 29 Jan 2014 16:53:30 +0000 (17:53 +0100)]
document port 0 == random available

6 years agodisplay actual port and address
Lukas Stabe [Wed, 29 Jan 2014 16:32:47 +0000 (17:32 +0100)]
display actual port and address

6 years agoDon't fprintf() inside signal handler, mark running as volatile.
Emil Mikulic [Thu, 13 Mar 2014 13:02:54 +0000 (00:02 +1100)]
Don't fprintf() inside signal handler, mark running as volatile.

6 years agoAdd script to run cppcheck.
Emil Mikulic [Tue, 7 Jan 2014 15:05:00 +0000 (02:05 +1100)]
Add script to run cppcheck.

6 years agoMore cppcheck nits.
Emil Mikulic [Tue, 7 Jan 2014 15:01:00 +0000 (02:01 +1100)]
More cppcheck nits.

6 years agoReduce variable scope to make cppcheck happy.
Emil Mikulic [Tue, 7 Jan 2014 14:55:12 +0000 (01:55 +1100)]
Reduce variable scope to make cppcheck happy.

7 years agoAdd test for --mimetypes
Emil Mikulic [Mon, 10 Jun 2013 10:41:46 +0000 (20:41 +1000)]
Add test for --mimetypes

7 years agoAdd test to exercise memove() in make_safe_url()
Emil Mikulic [Mon, 10 Jun 2013 09:26:25 +0000 (19:26 +1000)]
Add test to exercise memove() in make_safe_url()