]>
Commit | Line | Data |
---|---|---|
cc1350fa ER |
1 | Index: src/connections.c |
2 | =================================================================== | |
a9c05e12 ER |
3 | --- src/connections.c (.../tags/lighttpd-1.4.16) (revision 1922) |
4 | +++ src/connections.c (.../branches/lighttpd-1.4.x) (revision 1922) | |
5 | @@ -1412,42 +1412,42 @@ | |
6 | ||
7 | switch (r = http_response_prepare(srv, con)) { | |
8 | case HANDLER_FINISHED: | |
9 | - if (con->http_status == 404 || | |
10 | - con->http_status == 403) { | |
11 | - /* 404 error-handler */ | |
12 | + if (con->mode == DIRECT) { | |
13 | + if (con->http_status == 404 || | |
14 | + con->http_status == 403) { | |
15 | + /* 404 error-handler */ | |
16 | ||
17 | - if (con->in_error_handler == 0 && | |
18 | - (!buffer_is_empty(con->conf.error_handler) || | |
19 | - !buffer_is_empty(con->error_handler))) { | |
20 | - /* call error-handler */ | |
21 | + if (con->in_error_handler == 0 && | |
22 | + (!buffer_is_empty(con->conf.error_handler) || | |
23 | + !buffer_is_empty(con->error_handler))) { | |
24 | + /* call error-handler */ | |
25 | ||
26 | - con->error_handler_saved_status = con->http_status; | |
27 | - con->http_status = 0; | |
28 | + con->error_handler_saved_status = con->http_status; | |
29 | + con->http_status = 0; | |
30 | ||
31 | - if (buffer_is_empty(con->error_handler)) { | |
32 | - buffer_copy_string_buffer(con->request.uri, con->conf.error_handler); | |
33 | - } else { | |
34 | - buffer_copy_string_buffer(con->request.uri, con->error_handler); | |
35 | - } | |
36 | - buffer_reset(con->physical.path); | |
37 | + if (buffer_is_empty(con->error_handler)) { | |
38 | + buffer_copy_string_buffer(con->request.uri, con->conf.error_handler); | |
39 | + } else { | |
40 | + buffer_copy_string_buffer(con->request.uri, con->error_handler); | |
41 | + } | |
42 | + buffer_reset(con->physical.path); | |
43 | ||
44 | - con->in_error_handler = 1; | |
45 | + con->in_error_handler = 1; | |
46 | ||
47 | - connection_set_state(srv, con, CON_STATE_HANDLE_REQUEST); | |
48 | + connection_set_state(srv, con, CON_STATE_HANDLE_REQUEST); | |
49 | ||
50 | - done = -1; | |
51 | - break; | |
52 | + done = -1; | |
53 | + break; | |
54 | + } else if (con->in_error_handler) { | |
55 | + /* error-handler is a 404 */ | |
56 | + | |
57 | + con->http_status = con->error_handler_saved_status; | |
58 | + } | |
59 | } else if (con->in_error_handler) { | |
60 | - /* error-handler is a 404 */ | |
61 | - | |
62 | - con->http_status = con->error_handler_saved_status; | |
63 | + /* error-handler is back and has generated content */ | |
64 | + /* if Status: was set, take it otherwise use 200 */ | |
65 | } | |
66 | - } else if (con->in_error_handler) { | |
67 | - /* error-handler is back and has generated content */ | |
68 | - /* if Status: was set, take it otherwise use 200 */ | |
69 | - con->http_status = con->error_handler_saved_status; | |
cc1350fa | 70 | } |
a9c05e12 | 71 | - |
cc1350fa | 72 | if (con->http_status == 0) con->http_status = 200; |
cc1350fa | 73 | |
a9c05e12 ER |
74 | /* we have something to send, go on */ |
75 | Index: src/mod_staticfile.c | |
cc1350fa | 76 | =================================================================== |
a9c05e12 ER |
77 | --- src/mod_staticfile.c (.../tags/lighttpd-1.4.16) (revision 1922) |
78 | +++ src/mod_staticfile.c (.../branches/lighttpd-1.4.x) (revision 1922) | |
79 | @@ -506,6 +506,7 @@ | |
80 | */ | |
81 | http_chunk_append_file(srv, con, con->physical.path, 0, sce->st.st_size); | |
cc1350fa | 82 | |
a9c05e12 ER |
83 | + con->http_status = 200; |
84 | con->file_finished = 1; | |
cc1350fa | 85 | |
a9c05e12 | 86 | return HANDLER_FINISHED; |
cc1350fa ER |
87 | Index: src/etag.c |
88 | =================================================================== | |
a9c05e12 ER |
89 | --- src/etag.c (.../tags/lighttpd-1.4.16) (revision 1922) |
90 | +++ src/etag.c (.../branches/lighttpd-1.4.x) (revision 1922) | |
91 | @@ -1,4 +1,5 @@ | |
92 | #include <string.h> | |
93 | +#include <stdint.h> | |
cc1350fa | 94 | |
a9c05e12 ER |
95 | #include "buffer.h" |
96 | #include "etag.h" | |
97 | @@ -31,7 +32,8 @@ | |
cc1350fa | 98 | } |
8b19d016 | 99 | |
a9c05e12 ER |
100 | int etag_mutate(buffer *mut, buffer *etag) { |
101 | - size_t h, i; | |
102 | + size_t i; | |
103 | + uint32_t h; | |
cc1350fa | 104 | |
a9c05e12 | 105 | for (h=0, i=0; i < etag->used; ++i) h = (h<<5)^(h>>27)^(etag->ptr[i]); |
cc1350fa | 106 | |
a9c05e12 | 107 | Index: src/mod_mysql_vhost.c |
cc1350fa | 108 | =================================================================== |
a9c05e12 ER |
109 | --- src/mod_mysql_vhost.c (.../tags/lighttpd-1.4.16) (revision 1922) |
110 | +++ src/mod_mysql_vhost.c (.../branches/lighttpd-1.4.x) (revision 1922) | |
111 | @@ -252,6 +252,11 @@ | |
cc1350fa | 112 | |
a9c05e12 | 113 | return HANDLER_ERROR; |
cc1350fa | 114 | } |
cc1350fa | 115 | + |
a9c05e12 ER |
116 | + /* in mysql versions above 5.0.3 the reconnect flag is off by default */ |
117 | + my_bool reconnect = 1; | |
118 | + mysql_options(s->mysql, MYSQL_OPT_RECONNECT, &reconnect); | |
cc1350fa | 119 | + |
a9c05e12 | 120 | #define FOO(x) (s->x->used ? s->x->ptr : NULL) |
cc1350fa | 121 | |
a9c05e12 ER |
122 | if (!mysql_real_connect(s->mysql, FOO(hostname), FOO(myuser), FOO(mypass), |
123 | Index: src/mod_compress.c | |
cc1350fa | 124 | =================================================================== |
a9c05e12 ER |
125 | --- src/mod_compress.c (.../tags/lighttpd-1.4.16) (revision 1922) |
126 | +++ src/mod_compress.c (.../branches/lighttpd-1.4.x) (revision 1922) | |
127 | @@ -589,6 +589,13 @@ | |
128 | /* don't compress files that are too large as we need to much time to handle them */ | |
129 | if (max_fsize && (sce->st.st_size >> 10) > max_fsize) return HANDLER_GO_ON; | |
cc1350fa | 130 | |
a9c05e12 ER |
131 | + /* don't try to compress files less than 128 bytes |
132 | + * | |
133 | + * - extra overhead for compression | |
134 | + * - mmap() fails for st_size = 0 :) | |
135 | + */ | |
136 | + if (sce->st.st_size < 128) return HANDLER_GO_ON; | |
cc1350fa | 137 | + |
a9c05e12 ER |
138 | /* check if mimetype is in compress-config */ |
139 | for (m = 0; m < p->conf.compress->used; m++) { | |
140 | data_string *compress_ds = (data_string *)p->conf.compress->data[m]; | |
141 | Index: src/mod_dirlisting.c | |
cc1350fa | 142 | =================================================================== |
a9c05e12 ER |
143 | --- src/mod_dirlisting.c (.../tags/lighttpd-1.4.16) (revision 1922) |
144 | +++ src/mod_dirlisting.c (.../branches/lighttpd-1.4.x) (revision 1922) | |
145 | @@ -59,6 +59,7 @@ | |
cc1350fa | 146 | |
a9c05e12 ER |
147 | buffer *external_css; |
148 | buffer *encoding; | |
149 | + buffer *set_footer; | |
150 | } plugin_config; | |
cc1350fa | 151 | |
a9c05e12 ER |
152 | typedef struct { |
153 | @@ -173,6 +174,7 @@ | |
154 | excludes_buffer_free(s->excludes); | |
155 | buffer_free(s->external_css); | |
156 | buffer_free(s->encoding); | |
157 | + buffer_free(s->set_footer); | |
cc1350fa | 158 | |
a9c05e12 | 159 | free(s); |
cc1350fa | 160 | } |
a9c05e12 ER |
161 | @@ -240,7 +242,9 @@ |
162 | #define CONFIG_SHOW_HEADER "dir-listing.show-header" | |
163 | #define CONFIG_HIDE_HEADER_FILE "dir-listing.hide-header-file" | |
164 | #define CONFIG_DIR_LISTING "server.dir-listing" | |
165 | +#define CONFIG_SET_FOOTER "dir-listing.set-footer" | |
cc1350fa | 166 | |
cc1350fa | 167 | + |
a9c05e12 ER |
168 | SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) { |
169 | plugin_data *p = p_d; | |
170 | size_t i = 0; | |
171 | @@ -256,6 +260,7 @@ | |
172 | { CONFIG_SHOW_HEADER, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 7 */ | |
173 | { CONFIG_HIDE_HEADER_FILE, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 8 */ | |
174 | { CONFIG_DIR_LISTING, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 9 */ | |
175 | + { CONFIG_SET_FOOTER, NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 10 */ | |
176 | ||
177 | { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET } | |
178 | }; | |
179 | @@ -278,6 +283,7 @@ | |
180 | s->show_header = 0; | |
181 | s->hide_header_file = 0; | |
182 | s->encoding = buffer_init(); | |
183 | + s->set_footer = buffer_init(); | |
184 | ||
185 | cv[0].destination = s->excludes; | |
186 | cv[1].destination = &(s->dir_listing); | |
187 | @@ -289,6 +295,7 @@ | |
188 | cv[7].destination = &(s->show_header); | |
189 | cv[8].destination = &(s->hide_header_file); | |
190 | cv[9].destination = &(s->dir_listing); /* old name */ | |
191 | + cv[10].destination = s->set_footer; | |
cc1350fa | 192 | |
a9c05e12 ER |
193 | p->config_storage[i] = s; |
194 | ca = ((data_config *)srv->config_context->data[i])->value; | |
195 | @@ -318,6 +325,7 @@ | |
196 | PATCH(show_header); | |
197 | PATCH(hide_header_file); | |
198 | PATCH(excludes); | |
199 | + PATCH(set_footer); | |
cc1350fa | 200 | |
a9c05e12 ER |
201 | /* skip the first, the global context */ |
202 | for (i = 1; i < srv->config_context->used; i++) { | |
203 | @@ -348,6 +356,8 @@ | |
204 | PATCH(show_header); | |
205 | } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_HIDE_HEADER_FILE))) { | |
206 | PATCH(hide_header_file); | |
207 | + } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_SET_FOOTER))) { | |
208 | + PATCH(set_footer); | |
209 | } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_EXCLUDE))) { | |
210 | PATCH(excludes); | |
cc1350fa | 211 | } |
a9c05e12 ER |
212 | @@ -467,8 +477,7 @@ |
213 | "h2 {margin-bottom: 12px;}\n" | |
214 | "table {margin-left: 12px;}\n" | |
215 | "th, td {" | |
216 | - " font-family: \"Courier New\", Courier, monospace;" | |
217 | - " font-size: 10pt;" | |
218 | + " font: 90% monospace;" | |
219 | " text-align: left;" | |
220 | "}\n" | |
221 | "th {" | |
222 | @@ -488,8 +497,7 @@ | |
223 | " padding-bottom: 14px;" | |
224 | "}\n" | |
225 | "div.foot {" | |
226 | - " font-family: \"Courier New\", Courier, monospace;" | |
227 | - " font-size: 10pt;" | |
228 | + " font: 90% monospace;" | |
229 | " color: #787878;" | |
230 | " padding-top: 4px;" | |
231 | "}\n" | |
232 | @@ -569,7 +577,9 @@ | |
233 | "<div class=\"foot\">" | |
234 | ); | |
235 | ||
236 | - if (buffer_is_empty(con->conf.server_tag)) { | |
237 | + if (p->conf.set_footer->used > 1) { | |
238 | + buffer_append_string_buffer(out, p->conf.set_footer); | |
239 | + } else if (buffer_is_empty(con->conf.server_tag)) { | |
240 | BUFFER_APPEND_STRING_CONST(out, PACKAGE_NAME "/" PACKAGE_VERSION); | |
241 | } else { | |
242 | buffer_append_string_buffer(out, con->conf.server_tag); | |
243 | Index: tests/404-handler.conf | |
cc1350fa | 244 | =================================================================== |
a9c05e12 ER |
245 | --- tests/404-handler.conf (.../tags/lighttpd-1.4.16) (revision 0) |
246 | +++ tests/404-handler.conf (.../branches/lighttpd-1.4.x) (revision 1922) | |
247 | @@ -0,0 +1,49 @@ | |
248 | +debug.log-request-handling = "enable" | |
249 | +debug.log-response-header = "enable" | |
250 | +debug.log-request-header = "enable" | |
251 | + | |
252 | +server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" | |
253 | +server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid" | |
254 | + | |
255 | +## bind to port (default: 80) | |
256 | +server.port = 2048 | |
257 | + | |
258 | +## bind to localhost (default: all interfaces) | |
259 | +server.bind = "localhost" | |
260 | +server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log" | |
261 | +server.name = "www.example.org" | |
262 | +server.tag = "Apache 1.3.29" | |
263 | + | |
264 | + | |
265 | +server.modules = ( | |
266 | + "mod_fastcgi", | |
267 | + "mod_cgi", | |
268 | + "mod_accesslog" ) | |
269 | + | |
270 | +######################## MODULE CONFIG ############################ | |
271 | + | |
272 | + | |
273 | +accesslog.filename = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.access.log" | |
274 | + | |
275 | +mimetype.assign = ( ".html" => "text/html" ) | |
276 | + | |
277 | +cgi.assign = (".pl" => "/usr/bin/perl" ) | |
278 | + | |
279 | +# fastcgi.server += ( "/404.pl" => | |
280 | +# ( "404-handler" => | |
281 | +# ( | |
282 | +# "socket" => env.SRCDIR + "/tmp/pl-404-fastcgi-1.socket", | |
283 | +# "bin-path" => server.document-root + "/404.pl", | |
284 | +# "max-procs" => 1, | |
285 | +# "check-local" => "disable", | |
286 | +# "broken-scriptfilename" => "enable", | |
287 | +# ) | |
288 | +# ), | |
289 | +# ) | |
290 | + | |
291 | +$HTTP["url"] =~ "^/static/" { | |
292 | + server.error-handler-404 = "/404.html" | |
293 | +} | |
294 | +else $HTTP["url"] =~ "." { | |
295 | + server.error-handler-404 = "/404.pl" | |
296 | +} | |
297 | Index: tests/mod-cgi.t | |
cc1350fa | 298 | =================================================================== |
a9c05e12 ER |
299 | --- tests/mod-cgi.t (.../tags/lighttpd-1.4.16) (revision 1922) |
300 | +++ tests/mod-cgi.t (.../branches/lighttpd-1.4.x) (revision 1922) | |
cc1350fa ER |
301 | @@ -8,7 +8,7 @@ |
302 | ||
303 | use strict; | |
304 | use IO::Socket; | |
a9c05e12 ER |
305 | -use Test::More tests => 15; |
306 | +use Test::More tests => 16; | |
cc1350fa ER |
307 | use LightyTest; |
308 | ||
309 | my $tf = LightyTest->new(); | |
a9c05e12 ER |
310 | @@ -115,6 +115,13 @@ |
311 | ); | |
312 | $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, '+Content-Length' => '' } ]; | |
313 | ok($tf->handle_http($t) == 0, 'cgi-env: HTTP_HOST'); | |
314 | +# broken header crash | |
cc1350fa | 315 | +$t->{REQUEST} = ( <<EOF |
a9c05e12 | 316 | +GET /crlfcrash.pl HTTP/1.0 |
cc1350fa ER |
317 | +EOF |
318 | + ); | |
a9c05e12 ER |
319 | +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 500 } ]; |
320 | +ok($tf->handle_http($t) == 0, 'broken header via perl cgi'); | |
cc1350fa | 321 | |
a9c05e12 | 322 | ok($tf->stop_proc == 0, "Stopping lighttpd"); |
cc1350fa | 323 | |
a9c05e12 ER |
324 | Index: tests/docroot/www/crlfcrash.pl |
325 | =================================================================== | |
326 | --- tests/docroot/www/crlfcrash.pl (.../tags/lighttpd-1.4.16) (revision 0) | |
327 | +++ tests/docroot/www/crlfcrash.pl (.../branches/lighttpd-1.4.x) (revision 1922) | |
328 | @@ -0,0 +1,4 @@ | |
329 | +#!/usr/bin/env perl | |
330 | +# | |
331 | +print "Location: http://www.example.org/\r\n\n\n"; | |
332 | +exit; | |
333 | Index: tests/docroot/www/404.pl | |
334 | =================================================================== | |
335 | --- tests/docroot/www/404.pl (.../tags/lighttpd-1.4.16) (revision 0) | |
336 | +++ tests/docroot/www/404.pl (.../branches/lighttpd-1.4.x) (revision 1922) | |
337 | @@ -0,0 +1,33 @@ | |
338 | +#!/usr/bin/perl | |
339 | +use CGI qw/:standard/; | |
340 | +my $cgi = new CGI; | |
341 | +my $request_uri = $ENV{'REQUEST_URI'}; | |
342 | +print (STDERR "REQUEST_URI: $request_uri\n"); | |
343 | + | |
344 | +if ($request_uri =~ m/^\/dynamic\/200\// ) { | |
345 | + print header ( -status => 200, | |
346 | + -type => 'text/plain' ); | |
347 | + print ("found here\n"); | |
348 | +} | |
349 | +elsif ($request_uri =~ m|^/dynamic/302/| ) { | |
350 | + print header( -status=>302, | |
351 | + -location => 'http://www.example.org/'); | |
352 | +} | |
353 | +elsif ($request_uri =~ m/^\/dynamic\/404\// ) { | |
354 | + print header ( -status => 404 | |
355 | + -type => 'text/plain' ); | |
356 | + print ("Not found here\n"); | |
357 | +} | |
358 | +elsif ($request_uri =~ m/^\/send404\.pl/ ) { | |
359 | + print header ( -status => 404 | |
360 | + -type => 'text/plain' ); | |
361 | + print ("Not found here (send404)\n"); | |
362 | +} | |
363 | +elsif ($request_uri =~ m/^\/dynamic\/nostatus\// ) { | |
364 | + print ("found here\n"); | |
365 | +} | |
366 | +else { | |
367 | + print header ( -status => 500, | |
368 | + -type => 'text/plain'); | |
369 | + print ("huh\n"); | |
370 | +}; | |
371 | ||
372 | Property changes on: tests/docroot/www/404.pl | |
373 | ___________________________________________________________________ | |
374 | Name: svn:executable | |
375 | + * | |
376 | ||
377 | Index: tests/docroot/www/send404.pl | |
378 | =================================================================== | |
379 | --- tests/docroot/www/send404.pl (.../tags/lighttpd-1.4.16) (revision 0) | |
380 | +++ tests/docroot/www/send404.pl (.../branches/lighttpd-1.4.x) (revision 1922) | |
381 | @@ -0,0 +1,5 @@ | |
382 | +#!/usr/bin/perl | |
383 | +use CGI qw/:standard/; | |
384 | +print header ( -status => 404 | |
385 | + -type => 'text/plain' ); | |
386 | +print ("send404\n"); | |
387 | ||
388 | Property changes on: tests/docroot/www/send404.pl | |
389 | ___________________________________________________________________ | |
390 | Name: svn:executable | |
391 | + * | |
392 | ||
393 | Index: tests/docroot/www/404.html | |
394 | =================================================================== | |
395 | --- tests/docroot/www/404.html (.../tags/lighttpd-1.4.16) (revision 0) | |
396 | +++ tests/docroot/www/404.html (.../branches/lighttpd-1.4.x) (revision 1922) | |
397 | @@ -0,0 +1 @@ | |
398 | +static not found | |
399 | Index: tests/docroot/www/404.fcgi | |
400 | =================================================================== | |
401 | --- tests/docroot/www/404.fcgi (.../tags/lighttpd-1.4.16) (revision 0) | |
402 | +++ tests/docroot/www/404.fcgi (.../branches/lighttpd-1.4.x) (revision 1922) | |
403 | @@ -0,0 +1,27 @@ | |
404 | +#!/usr/bin/perl | |
405 | +#use CGI qw/:standard/; | |
406 | +use CGI::Fast qw(:standard); | |
407 | +my $cgi = new CGI; | |
408 | +while (new CGI::Fast) { | |
409 | + my $request_uri = $ENV{'REQUEST_URI'}; | |
410 | + print (STDERR "REQUEST_URI: $request_uri\n"); | |
411 | + if ($request_uri =~ m/^\/dynamic\/200\// ) { | |
412 | + print header ( -status => 200, | |
413 | + -type => 'text/plain' ); | |
414 | + print ("found here\n"); | |
415 | + } | |
416 | + elsif ($request_uri =~ m|^/dynamic/302/| ) { | |
417 | + print header( -status=>302, | |
418 | + -location => 'http://www.example.org/'); | |
419 | + } | |
420 | + elsif ($request_uri =~ m/^\/dynamic\/404\// ) { | |
421 | + print header ( -status => 404 | |
422 | + -type => 'text/plain' ); | |
423 | + print ("Not found here\n"); | |
424 | + } | |
425 | + else { | |
426 | + print header ( -status => 500, | |
427 | + -type => 'text/plain'); | |
428 | + print ("huh\n"); | |
429 | + }; | |
430 | +}; | |
431 | ||
432 | Property changes on: tests/docroot/www/404.fcgi | |
433 | ___________________________________________________________________ | |
434 | Name: svn:executable | |
435 | + * | |
436 | ||
437 | Index: tests/core-404-handler.t | |
438 | =================================================================== | |
439 | --- tests/core-404-handler.t (.../tags/lighttpd-1.4.16) (revision 0) | |
440 | +++ tests/core-404-handler.t (.../branches/lighttpd-1.4.x) (revision 1922) | |
441 | @@ -0,0 +1,76 @@ | |
442 | +#!/usr/bin/env perl | |
443 | +# | |
444 | +# combinations we have to test: | |
445 | +# plain 404 case | |
446 | +# 404-handler -> static file (verify content) | |
447 | +# 404-handler -> fastcgi | |
448 | +# returning 200 | |
449 | +# returning 302 + Location | |
450 | +# returning 404 | |
451 | +# returning no status -> 200 | |
452 | +# | |
453 | +BEGIN { | |
454 | + # add current source dir to the include-path | |
455 | + # we need this for make distcheck | |
456 | + (my $srcdir = $0) =~ s#/[^/]+$#/#; | |
457 | + unshift @INC, $srcdir; | |
458 | +} | |
459 | + | |
460 | +use strict; | |
461 | +use IO::Socket; | |
462 | +use Test::More tests => 8; | |
463 | +use LightyTest; | |
464 | + | |
465 | +my $tf = LightyTest->new(); | |
466 | +my $t; | |
467 | +$tf->{CONFIGFILE} = '404-handler.conf'; | |
468 | + | |
469 | +ok($tf->start_proc == 0, "Starting lighttpd") or die(); | |
470 | + | |
cc1350fa | 471 | +$t->{REQUEST} = ( <<EOF |
a9c05e12 | 472 | +GET /static/notfound HTTP/1.0 |
cc1350fa ER |
473 | +EOF |
474 | + ); | |
a9c05e12 ER |
475 | +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => "static not found\n" } ]; |
476 | +ok($tf->handle_http($t) == 0, '404 handler => static'); | |
cc1350fa | 477 | + |
a9c05e12 ER |
478 | +# |
479 | +# | |
480 | +# | |
cc1350fa | 481 | +$t->{REQUEST} = ( <<EOF |
a9c05e12 | 482 | +GET /dynamic/200/notfound HTTP/1.0 |
cc1350fa ER |
483 | +EOF |
484 | + ); | |
a9c05e12 ER |
485 | +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => "found here\n" } ]; |
486 | +ok($tf->handle_http($t) == 0, '404 handler => dynamic(200)'); | |
cc1350fa | 487 | + |
cc1350fa | 488 | +$t->{REQUEST} = ( <<EOF |
a9c05e12 | 489 | +GET /dynamic/302/notfound HTTP/1.0 |
cc1350fa ER |
490 | +EOF |
491 | + ); | |
a9c05e12 ER |
492 | +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 302, 'Location' => "http://www.example.org/" } ]; |
493 | +ok($tf->handle_http($t) == 0, '404 handler => dynamic(302)'); | |
cc1350fa | 494 | + |
cc1350fa | 495 | +$t->{REQUEST} = ( <<EOF |
a9c05e12 | 496 | +GET /dynamic/404/notfound HTTP/1.0 |
cc1350fa ER |
497 | +EOF |
498 | + ); | |
a9c05e12 ER |
499 | +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'HTTP-Content' => "Not found here\n" } ]; |
500 | +ok($tf->handle_http($t) == 0, '404 handler => dynamic(404)'); | |
501 | + | |
cc1350fa | 502 | +$t->{REQUEST} = ( <<EOF |
a9c05e12 | 503 | +GET /dynamic/nostatus/notfound HTTP/1.0 |
cc1350fa ER |
504 | +EOF |
505 | + ); | |
a9c05e12 ER |
506 | +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => "found here\n" } ]; |
507 | +ok($tf->handle_http($t) == 0, '404 handler => dynamic(nostatus)'); | |
cc1350fa ER |
508 | + |
509 | +$t->{REQUEST} = ( <<EOF | |
a9c05e12 | 510 | +GET /send404.pl HTTP/1.0 |
cc1350fa ER |
511 | +EOF |
512 | + ); | |
a9c05e12 ER |
513 | +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'HTTP-Content' => "send404\n" } ]; |
514 | +ok($tf->handle_http($t) == 0, '404 generated by CGI should stay 404'); | |
cc1350fa | 515 | + |
a9c05e12 | 516 | +ok($tf->stop_proc == 0, "Stopping lighttpd"); |
cc1350fa | 517 | + |
a9c05e12 | 518 | Index: doc/lighttpd.conf |
cc1350fa | 519 | =================================================================== |
a9c05e12 ER |
520 | --- doc/lighttpd.conf (.../tags/lighttpd-1.4.16) (revision 1922) |
521 | +++ doc/lighttpd.conf (.../branches/lighttpd-1.4.x) (revision 1922) | |
522 | @@ -37,10 +37,10 @@ | |
523 | ||
524 | ## a static document-root, for virtual-hosting take look at the | |
525 | ## server.virtual-* options | |
526 | -server.document-root = "/www/pages/" | |
527 | +server.document-root = "/srv/www/htdocs/" | |
528 | ||
529 | ## where to send error-messages to | |
530 | -server.errorlog = "/www/logs/lighttpd.error.log" | |
531 | +server.errorlog = "/var/log/lighttpd/error.log" | |
532 | ||
533 | # files to check for if .../ is requested | |
534 | index-file.names = ( "index.php", "index.html", | |
535 | @@ -101,7 +101,9 @@ | |
536 | ".wmv" => "video/x-ms-wmv", | |
537 | ".bz2" => "application/x-bzip", | |
538 | ".tbz" => "application/x-bzip-compressed-tar", | |
539 | - ".tar.bz2" => "application/x-bzip-compressed-tar" | |
540 | + ".tar.bz2" => "application/x-bzip-compressed-tar", | |
541 | + # default mime type | |
542 | + "" => "application/octet-stream", | |
543 | ) | |
544 | ||
545 | # Use the "Content-Type" extended attribute to obtain mime type if possible | |
546 | @@ -113,7 +115,7 @@ | |
547 | # server.tag = "lighttpd" | |
548 | ||
549 | #### accesslog module | |
550 | -accesslog.filename = "/www/logs/access.log" | |
551 | +accesslog.filename = "/var/log/lighttpd/access.log" | |
552 | ||
553 | ## deny access the file-extensions | |
554 | # | |
555 | @@ -138,7 +140,7 @@ | |
556 | #server.port = 81 | |
557 | ||
558 | ## bind to localhost (default: all interfaces) | |
559 | -#server.bind = "grisu.home.kneschke.de" | |
560 | +#server.bind = "127.0.0.1" | |
561 | ||
562 | ## error-handler for status 404 | |
563 | #server.error-handler-404 = "/error-handler.html" | |
564 | @@ -158,15 +160,16 @@ | |
565 | ## or | |
566 | ## virtual-server-root + http-host + virtual-server-docroot | |
567 | ## | |
568 | -#simple-vhost.server-root = "/home/weigon/wwwroot/servers/" | |
569 | -#simple-vhost.default-host = "grisu.home.kneschke.de" | |
570 | -#simple-vhost.document-root = "/pages/" | |
571 | +#simple-vhost.server-root = "/srv/www/vhosts/" | |
572 | +#simple-vhost.default-host = "www.example.org" | |
573 | +#simple-vhost.document-root = "/htdocs/" | |
574 | ||
575 | ||
576 | ## | |
577 | ## Format: <errorfile-prefix><status-code>.html | |
578 | ## -> ..../status-404.html for 'File not found' | |
579 | -#server.errorfile-prefix = "/home/weigon/projects/lighttpd/doc/status-" | |
580 | +#server.errorfile-prefix = "/usr/share/lighttpd/errors/status-" | |
581 | +#server.errorfile-prefix = "/srv/www/errors/status-" | |
582 | ||
583 | ## virtual directory listings | |
584 | #dir-listing.activate = "enable" | |
585 | @@ -189,7 +192,7 @@ | |
586 | #server.groupname = "wwwrun" | |
587 | ||
588 | #### compress module | |
589 | -#compress.cache-dir = "/tmp/lighttpd/cache/compress/" | |
590 | +#compress.cache-dir = "/var/cache/lighttpd/compress/" | |
591 | #compress.filetype = ("text/plain", "text/html") | |
592 | ||
593 | #### proxy module | |
594 | @@ -209,8 +212,8 @@ | |
595 | #fastcgi.server = ( ".php" => | |
596 | # ( "localhost" => | |
597 | # ( | |
598 | -# "socket" => "/tmp/php-fastcgi.socket", | |
599 | -# "bin-path" => "/usr/local/bin/php" | |
600 | +# "socket" => "/var/run/lighttpd/php-fastcgi.socket", | |
601 | +# "bin-path" => "/usr/local/bin/php-cgi" | |
602 | # ) | |
603 | # ) | |
604 | # ) | |
605 | @@ -222,7 +225,7 @@ | |
606 | ||
607 | #### SSL engine | |
608 | #ssl.engine = "enable" | |
609 | -#ssl.pemfile = "server.pem" | |
610 | +#ssl.pemfile = "/etc/ssl/private/lighttpd.pem" | |
611 | ||
612 | #### status module | |
613 | #status.status-url = "/server-status" | |
614 | @@ -269,7 +272,7 @@ | |
615 | # %3 => subdomain 1 name | |
616 | # %4 => subdomain 2 name | |
617 | # | |
618 | -#evhost.path-pattern = "/home/storage/dev/www/%3/htdocs/" | |
619 | +#evhost.path-pattern = "/srv/www/vhosts/%3/htdocs/" | |
620 | ||
621 | #### expire module | |
622 | #expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes") | |
623 | @@ -279,14 +282,14 @@ | |
624 | ||
625 | #### rrdtool | |
626 | #rrdtool.binary = "/usr/bin/rrdtool" | |
627 | -#rrdtool.db-name = "/var/www/lighttpd.rrd" | |
628 | +#rrdtool.db-name = "/var/lib/lighttpd/lighttpd.rrd" | |
629 | ||
630 | #### setenv | |
631 | #setenv.add-request-header = ( "TRAV_ENV" => "mysql://user@host/db" ) | |
632 | #setenv.add-response-header = ( "X-Secret-Message" => "42" ) | |
633 | ||
634 | ## for mod_trigger_b4_dl | |
635 | -# trigger-before-download.gdbm-filename = "/home/weigon/testbase/trigger.db" | |
636 | +# trigger-before-download.gdbm-filename = "/var/lib/lighttpd/trigger.db" | |
637 | # trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" ) | |
638 | # trigger-before-download.trigger-url = "^/trigger/" | |
639 | # trigger-before-download.download-url = "^/download/" | |
cc1350fa ER |
640 | Index: NEWS |
641 | =================================================================== | |
a9c05e12 ER |
642 | --- NEWS (.../tags/lighttpd-1.4.16) (revision 1922) |
643 | +++ NEWS (.../branches/lighttpd-1.4.x) (revision 1922) | |
644 | @@ -3,6 +3,13 @@ | |
cc1350fa ER |
645 | NEWS |
646 | ==== | |
647 | ||
a9c05e12 ER |
648 | +- 1.4.17 - |
649 | + * added dir-listing.set-footer in mod_dirlisting (#1277) | |
650 | + * fixed hardcoded font-sizes in mod_dirlisting (#1267) | |
651 | + * fixed different ETag length on 32/64 platforms (#1279) | |
652 | + * fixed compression of files < 128 bytes by disabling compression (#1241) | |
653 | + * fixed mysql server reconnects (#518) | |
cc1350fa | 654 | + |
a9c05e12 | 655 | - 1.4.16 - |
cc1350fa | 656 | |
a9c05e12 | 657 | * added static-file.etags, etag.use-inode, etag.use-mtime, etag.use-size |