Commit Graph

123 Commits

Author SHA1 Message Date
Emil Mikulic
c4c0034242 Add --default-mimetype flag. 2015-05-19 21:40:26 +10:00
Emil Mikulic
e9aeaba7fe Add test for --no-listing. 2015-05-19 21:30:59 +10:00
Emil Mikulic
fc8e127bb7 Fix memory leak. 2015-05-19 21:17:42 +10:00
Christian Hesse
6564a65dfa mention --forward-all in help output
Signed-off-by: Christian Hesse <mail@eworm.de>
2015-05-19 21:04:02 +10:00
Christian Hesse
03f4c1f390 add option to deny directory listing
Signed-off-by: Christian Hesse <mail@eworm.de>
2015-05-19 21:02:58 +10:00
Emil Mikulic
4e726692f4 [ darkhttpd 1.11 release ] 2015-01-01 22:42:44 +11:00
Emil Mikulic
aa8046a5a1 Remove unused var, add casts to str_to_num() calls. 2015-01-01 22:41:35 +11:00
Emil Mikulic
49ad7a0421 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
2015-01-01 22:22:41 +11:00
Emil Mikulic
d5bd7558f4 Make str_to_num() check for ERANGE, use it instead of atoi(). 2015-01-01 21:00:57 +11:00
Emil Mikulic
4c8b1e22f3 chomp() isn't needed because read_line() strips [cr]lf. 2015-01-01 20:38:38 +11:00
Emil Mikulic
6e1f045393 Test resize in appendl(). 2015-01-01 20:35:37 +11:00
Emil Mikulic
4bf0ef5896 Zero slashes should be impossible here. 2015-01-01 18:26:35 +11:00
Emil Mikulic
32158f92b4 [ darkhttpd 1.10 release ] 2014-05-26 22:07:59 +10:00
Emil Mikulic
11f953e783 printf [s]size_t as %z[du]. 2014-05-26 21:56:45 +10:00
Emil Mikulic
e8a38f9c6a Remove query params.
Reported by: James Antill
https://bugzilla.redhat.com/show_bug.cgi?id=1099199
2014-05-26 21:36:29 +10:00
Emil Mikulic
a8bc378777 Silence warning about unused arg. 2014-03-14 22:45:39 +11:00
Emil Mikulic
f73bf69a1e Implement --forward-all to forward all requests to a given url.
Suggested and initially implemented by: Christian Hesse <mail@eworm.de>
2014-03-14 22:40:55 +11:00
Emil Mikulic
d28bb0c9f7 ntohs() when reporting the port number.
Re-use addrin when fetching the port number.
2014-03-14 22:18:51 +11:00
Lukas Stabe
28c382d454 exit cleanly for --help 2014-03-14 22:07:37 +11:00
Lukas Stabe
aa9859413e document port 0 == random available 2014-03-14 22:07:37 +11:00
Lukas Stabe
bcadc424a4 display actual port and address 2014-03-14 22:07:37 +11:00
Emil Mikulic
b43fee3c83 Don't fprintf() inside signal handler, mark running as volatile. 2014-03-14 21:52:59 +11:00
Emil Mikulic
c44730e177 More cppcheck nits. 2014-03-14 21:52:59 +11:00
Emil Mikulic
ad1f132cf2 Reduce variable scope to make cppcheck happy. 2014-03-14 21:52:59 +11:00
Emil Mikulic
1f3f104166 Fix file_exists() comparison.
Found with: git://repo.or.cz/smatch.git
2013-06-10 18:56:14 +10:00
Emil Mikulic
5d1bdd1fd3 [ darkhttpd-1.9 release ]
Add release script.
2013-04-29 01:47:24 +10:00
Egor Ivanov
049e842399 Optimization for case when no web forward is configured. 2013-04-29 01:47:15 +10:00
Emil Mikulic
5a0291f47e Implement --no-server-id
Suggested by: T.Ramirez
2013-04-29 00:55:08 +10:00
Emil Mikulic
e6e17fa0f3 Change web_forward_record from a hand-rolled linked list to an array.
Free it before exiting.
2013-04-28 23:48:16 +10:00
Egor Ivanov
ab7af194e6 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.
2013-04-28 22:58:40 +10:00
Emil Mikulic
ffbb4c9f7c Fix memory leak when diropen() fails.
Found by: clang static analyzer.
2013-04-28 21:39:43 +10:00
Emil Mikulic
a20e840c97 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.
2013-04-28 21:37:31 +10:00
Emil Mikulic
efe37364eb Fix warnings found by clang r180088. 2013-04-28 21:24:33 +10:00
Emil Mikulic
c7db17bcec Put project page and contact address into comments. 2013-04-28 21:03:29 +10:00
Emil Mikulic
d26a2956bf Make keep_alive() a tiny function instead of a macro. 2013-04-28 21:01:31 +10:00
Emil Mikulic
a9a2aff851 Implement --no-keepalive.
Requested by: Devin LaSalle
2013-04-28 20:59:13 +10:00
Vlatko Kosturjak
9ca7ed4795 Fix for when MAXNAMLEN is not found (Android) 2013-04-28 20:59:13 +10:00
Emil Mikulic
a8176d0ed0 [ darkhttpd-1.8 release ]
printf format fixes from FreeBSD 8.2 (gcc version 4.2.1)
2013-04-28 20:59:05 +10:00
Emil Mikulic
8cdcad43c2 Add guard around __printflike 2013-04-28 20:57:09 +10:00
Emil Mikulic
07be6a2f1b Bring preprocessor directives in line. 2013-04-28 20:56:56 +10:00
Emil Mikulic
a3b31af2be Don't catch SIGQUIT.
I'm okay with this being more fatal.
2013-04-28 20:56:56 +10:00
Emil Mikulic
e8c3e92aa9 Re-arrange usage(). 2013-04-28 20:56:46 +10:00
Emil Mikulic
862e3ac124 Improve handling of invalid ranges. 2013-04-28 20:56:46 +10:00
Emil Mikulic
aa0ec26397 Advertise that we accept ranges. 2013-04-28 20:56:46 +10:00
Emil Mikulic
a0c87d39a2 Remove unnecessary headers from 304 reply. 2013-04-28 20:56:46 +10:00
Emil Mikulic
b6df049c49 Improve "caught Terminated" output. 2013-04-28 20:56:14 +10:00
Emil Mikulic
7faf2787e4 parse_field() was looking for \r instead of [\r\n] 2013-04-28 20:56:14 +10:00
Emil Mikulic
36f22757f3 When logging, escape strings.
While I'm here, rename urlencode[_filename]() and improve it.
2013-04-28 20:56:04 +10:00
Emil Mikulic
5ebb93d253 Log to stdout by default. 2013-04-28 20:56:04 +10:00
Emil Mikulic
4ce6e87748 Print "listening on" as a URL. 2013-04-28 20:56:04 +10:00
Emil Mikulic
58dca3d6b1 Default to --port 8080, or 80 if running as root. 2013-04-28 20:56:04 +10:00
Emil Mikulic
010d194180 uri -> url 2013-04-28 20:56:04 +10:00
Emil Mikulic
0ee2c3b2bf Accept \n as line ending when parsing URL.
This fixes "HTTP 0.9" requests.
2013-04-28 20:56:04 +10:00
Emil Mikulic
adb6b02603 Print more quotes. 2013-04-28 20:55:57 +10:00
Emil Mikulic
ccbe7cffa7 Don't qsort() NULL.
Found by: clang static analyzer
2013-04-28 20:37:08 +10:00
Emil Mikulic
1b7bbcc033 Fix clang nits. 2013-04-28 20:37:08 +10:00
Emil Mikulic
11bb4d8906 Use int over size_t. 2013-04-28 20:37:08 +10:00
Emil Mikulic
014ce0e988 Don't use init decls, they're C99. 2013-04-28 20:37:08 +10:00
Emil Mikulic
f32ffbabd5 Finished style changes. 2013-04-28 20:37:08 +10:00
Emil Mikulic
7343ecf35f More style changes, fixed most of the compiler warnings. 2013-04-28 20:37:08 +10:00
Emil Mikulic
0442d41dab More style changes, move a function. 2013-04-28 20:37:08 +10:00
Emil Mikulic
775cd3ad9b Mostly style changes. 2013-04-28 20:37:01 +10:00
Emil Mikulic
1fa02dc545 Restyle and add printflike. 2013-04-28 20:36:56 +10:00
Emil Mikulic
8d11e14d11 Bump copyright year. 2013-04-28 20:34:03 +10:00
Emil Mikulic
8393796097 More inttype tweaks. 2013-04-28 20:33:20 +10:00
Emil Mikulic
bc692bb5f7 Casts and indents. 2013-04-28 20:33:14 +10:00
Emil Mikulic
7c65160849 Cosmetics. 2013-04-28 20:33:14 +10:00
Emil Mikulic
ec246e2a51 Avoid infinite loop (and quiet gcc warning) 2013-04-28 20:33:14 +10:00
Emil Mikulic
803655dba9 Ranges work now. 2013-04-28 20:33:14 +10:00
Emil Mikulic
41f4ec2d50 Should these be unsigned? 2013-04-28 20:33:13 +10:00
Emil Mikulic
3cc77c31d6 More longlong fixes. 2013-04-28 20:33:07 +10:00
Emil Mikulic
63bdabd79f Working on large file support. 2011-01-15 14:37:56 +11:00
Emil Mikulic
0ab76c953b Move trunk/ into base dir, move tests into devel/. 2013-04-28 20:44:06 +10:00