darkhttpd
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()

7 years agoREADME: update default port.
Emil Mikulic [Mon, 10 Jun 2013 08:59:55 +0000 (18:59 +1000)]
README: update default port.

7 years agoFix file_exists() comparison.
Emil Mikulic [Mon, 10 Jun 2013 08:56:14 +0000 (18:56 +1000)]
Fix file_exists() comparison.

Found with: git://repo.or.cz/smatch.git

7 years agoMakefile: move .PHONY to the end.
Emil Mikulic [Mon, 10 Jun 2013 08:53:19 +0000 (18:53 +1000)]
Makefile: move .PHONY to the end.

7 years agoTests: add pointer to cover script which runs them.
Emil Mikulic [Mon, 10 Jun 2013 08:52:38 +0000 (18:52 +1000)]
Tests: add pointer to cover script which runs them.

7 years ago[ darkhttpd-1.9 release ]
Emil Mikulic [Sun, 28 Apr 2013 15:06:31 +0000 (01:06 +1000)]
[ darkhttpd-1.9 release ]

Add release script.

7 years agoOptimization for case when no web forward is configured.
Egor Ivanov [Tue, 23 Apr 2013 16:31:21 +0000 (20:31 +0400)]
Optimization for case when no web forward is configured.

7 years agoImplement --no-server-id
Emil Mikulic [Sun, 28 Apr 2013 14:55:08 +0000 (00:55 +1000)]
Implement --no-server-id

Suggested by: T.Ramirez

7 years agoAdd test for --forward
Emil Mikulic [Sun, 28 Apr 2013 14:31:54 +0000 (00:31 +1000)]
Add test for --forward

7 years agoChange web_forward_record from a hand-rolled linked list to an array.
Emil Mikulic [Sun, 28 Apr 2013 13:48:16 +0000 (23:48 +1000)]
Change web_forward_record from a hand-rolled linked list to an array.

Free it before exiting.

7 years agoImplement --forward.
Egor Ivanov [Sat, 20 Apr 2013 10:05:27 +0000 (14:05 +0400)]
Implement --forward.

A web forward feature that performs 301 redirects for some requests
(in addition normal web content serving)

The "Host:" request header (HTTP/1.1 only) is compared with a list of
hosts, defined by the "--forward host url" option. If a match is found,
the request is redirected to url+path. Otherwise, it is served as a
request to the local file system.

7 years agoMake devel/cover clean up after itself.
Emil Mikulic [Sun, 28 Apr 2013 11:45:14 +0000 (21:45 +1000)]
Make devel/cover clean up after itself.

7 years agoFix memory leak when diropen() fails.
Emil Mikulic [Sun, 28 Apr 2013 11:39:43 +0000 (21:39 +1000)]
Fix memory leak when diropen() fails.

Found by: clang static analyzer.

7 years agoMake sure malloc and realloc can't be called with size 0.
Emil Mikulic [Sun, 28 Apr 2013 11:37:31 +0000 (21:37 +1000)]
Make sure malloc and realloc can't be called with size 0.

Make pool size double instead of increment in make_sorted_dirlist().

Prompted by: clang static analyzer.

7 years agoFix warnings found by clang r180088.
Emil Mikulic [Sun, 28 Apr 2013 11:24:33 +0000 (21:24 +1000)]
Fix warnings found by clang r180088.

7 years agoClean up and improve the devel/ scripts.
Emil Mikulic [Sun, 28 Apr 2013 11:16:40 +0000 (21:16 +1000)]
Clean up and improve the devel/ scripts.

7 years agoPut project page and contact address into comments.
Emil Mikulic [Sun, 28 Apr 2013 11:03:29 +0000 (21:03 +1000)]
Put project page and contact address into comments.

7 years agoMake keep_alive() a tiny function instead of a macro.
Emil Mikulic [Sun, 28 Apr 2013 11:01:31 +0000 (21:01 +1000)]
Make keep_alive() a tiny function instead of a macro.

7 years agoImplement --no-keepalive.
Emil Mikulic [Mon, 28 May 2012 10:33:52 +0000 (20:33 +1000)]
Implement --no-keepalive.

Requested by: Devin LaSalle

7 years agoFix for when MAXNAMLEN is not found (Android)
Vlatko Kosturjak [Wed, 30 Jun 2010 22:21:35 +0000 (00:21 +0200)]
Fix for when MAXNAMLEN is not found (Android)

7 years ago[ darkhttpd-1.8 release ]
Emil Mikulic [Tue, 3 May 2011 10:53:50 +0000 (20:53 +1000)]
[ darkhttpd-1.8 release ]

printf format fixes from FreeBSD 8.2 (gcc version 4.2.1)

7 years agoAdd guard around __printflike
Emil Mikulic [Tue, 3 May 2011 10:50:31 +0000 (20:50 +1000)]
Add guard around __printflike

7 years agoTest large (>2G, >4G) files.
Emil Mikulic [Tue, 3 May 2011 10:43:04 +0000 (20:43 +1000)]
Test large (>2G, >4G) files.

7 years agoRun usage, not really a test.
Emil Mikulic [Tue, 3 May 2011 10:14:10 +0000 (20:14 +1000)]
Run usage, not really a test.

7 years agoCheck dependencies in devel/cover
Emil Mikulic [Tue, 3 May 2011 10:11:09 +0000 (20:11 +1000)]
Check dependencies in devel/cover

7 years agoBring preprocessor directives in line.
Emil Mikulic [Sun, 1 May 2011 09:29:13 +0000 (19:29 +1000)]
Bring preprocessor directives in line.

7 years agoDon't catch SIGQUIT.
Emil Mikulic [Sun, 1 May 2011 09:25:14 +0000 (19:25 +1000)]
Don't catch SIGQUIT.

I'm okay with this being more fatal.

7 years agoRe-arrange usage().
Emil Mikulic [Sun, 1 May 2011 09:24:31 +0000 (19:24 +1000)]
Re-arrange usage().

7 years agoSingle byte corner cases.
Emil Mikulic [Sun, 1 May 2011 09:19:39 +0000 (19:19 +1000)]
Single byte corner cases.

7 years agoTest directory redirect.
Emil Mikulic [Sun, 1 May 2011 09:13:25 +0000 (19:13 +1000)]
Test directory redirect.

7 years agoImprove handling of invalid ranges.
Emil Mikulic [Sun, 1 May 2011 09:08:29 +0000 (19:08 +1000)]
Improve handling of invalid ranges.

7 years agoStill more range test fiddling.
Emil Mikulic [Sun, 1 May 2011 09:08:12 +0000 (19:08 +1000)]
Still more range test fiddling.

7 years agoAdd test for backwards range.
Emil Mikulic [Sun, 1 May 2011 08:56:04 +0000 (18:56 +1000)]
Add test for backwards range.

7 years agoPassing bad-end range test.
Emil Mikulic [Sun, 1 May 2011 08:54:06 +0000 (18:54 +1000)]
Passing bad-end range test.

7 years agoTest range requests, including one failing test.
Emil Mikulic [Sun, 1 May 2011 08:49:18 +0000 (18:49 +1000)]
Test range requests, including one failing test.

7 years agoAdvertise that we accept ranges.
Emil Mikulic [Sun, 1 May 2011 08:43:14 +0000 (18:43 +1000)]
Advertise that we accept ranges.