Project

General

Profile

lighttpd-1.4.29.mod_deflate.patch

Updated patch for 1.4.29. - Anonymous, 2011-07-15 21:30

View differences:

lighttpd-1.4.29/configure 2011-07-15 20:23:47.237137726 +0100
18501 18501

  
18502 18502

  
18503 18503
do_build="mod_cgi mod_fastcgi mod_extforward mod_proxy mod_evhost mod_simple_vhost mod_access mod_alias mod_setenv mod_usertrack mod_auth mod_status mod_accesslog"
18504
do_build="$do_build mod_rrdtool mod_secdownload mod_expire mod_compress mod_dirlisting mod_indexfile mod_userdir mod_webdav mod_staticfile mod_scgi mod_flv_streaming"
18504
do_build="$do_build mod_rrdtool mod_secdownload mod_expire mod_compress mod_dirlisting mod_indexfile mod_userdir mod_webdav mod_staticfile mod_scgi mod_flv_streaming mod_deflate"
18505 18505

  
18506 18506
plugins="mod_rewrite mod_redirect mod_ssi mod_trigger_b4_dl"
18507 18507
features="regex-conditionals"
lighttpd-1.4.29/Makefile.in 2011-07-15 20:23:47.237137726 +0100
754 754
	install install-am install-data install-data-am install-dvi \
755 755
	install-dvi-am install-exec install-exec-am install-html \
756 756
	install-html-am install-info install-info-am install-man \
757
	install-pdf install-pdf-am install-ps install-ps-am \
758
	install-strip installcheck installcheck-am installdirs \
759
	installdirs-am maintainer-clean maintainer-clean-generic \
760
	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
761
	ps ps-am tags tags-recursive uninstall uninstall-am
757
	install-pdf install-pdf-am install-pkgconfigDATA install-ps \
758
	install-ps-am install-strip installcheck installcheck-am \
759
	installdirs installdirs-am maintainer-clean \
760
	maintainer-clean-generic mostlyclean mostlyclean-generic \
761
	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
762
	uninstall uninstall-am uninstall-pkgconfigDATA
762 763

  
763 764

  
764 765
# Tell versions [3.59,3.63) of GNU make to not export all variables.
lighttpd-1.4.29/src/base.h 2011-07-15 20:23:47.237137726 +0100
153 153

  
154 154
	http_method_t  http_method;
155 155
	http_version_t http_version;
156
	int true_http_10_client;
156 157

  
157 158
	buffer *request_line;
158 159

  
......
380 381

  
381 382
	int file_started;
382 383
	int file_finished;
384
	int end_chunk; /* used for chunked transfer encoding. */
383 385

  
384
	chunkqueue *write_queue;      /* a large queue for low-level write ( HTTP response ) [ file, mem ] */
386
	chunkqueue *write_queue;  /* a large queue for HTTP response content [ file, mem ] */
387
	chunkqueue *output_queue; /* a large queue for low-level write ( HTTP response ) [ file, mem ] */
385 388
	chunkqueue *read_queue;       /* a small queue for low-level read ( HTTP request ) [ mem ] */
386 389
	chunkqueue *request_content_queue; /* takes request-content into tempfile if necessary [ tempfile, mem ]*/
387 390

  
......
626 629

  
627 630
	connections *conns;
628 631
	connections *joblist;
632
	connections *joblist_prev;
629 633
	connections *fdwaitqueue;
630 634

  
631 635
	stat_cache  *stat_cache;
lighttpd-1.4.29/src/chunk.c 2011-07-15 20:23:47.237137726 +0100
4 4
 *
5 5
 */
6 6

  
7
#include "server.h"
7 8
#include "chunk.h"
9
#include "log.h"
8 10

  
9 11
#include <sys/types.h>
10 12
#include <sys/stat.h>
......
239 241
	return 0;
240 242
}
241 243

  
244
int chunkqueue_append_chunkqueue(chunkqueue *cq, chunkqueue *src) {
245
	if(src == NULL) return 0;
246
	chunkqueue_append_chunk(cq, src->first);
247
	cq->last = src->last;
248
	src->first = NULL;
249
	src->last = NULL;
250

  
251
	return 0;
252
}
253

  
254

  
242 255
buffer * chunkqueue_get_prepend_buffer(chunkqueue *cq) {
243 256
	chunk *c;
244 257

  
......
398 411

  
399 412
	return 0;
400 413
}
414

  
415

  
416
/**
417
 * the HTTP chunk-API
418
 * 
419
 * 
420
 */
421

  
422
static int chunk_encode_append_len(chunkqueue *cq, size_t len) {
423
	size_t i, olen = len, j;
424
	buffer *b;
425
	
426
	/*b = srv->tmp_chunk_len;*/
427
	/*b = buffer_init();*/
428
	b = chunkqueue_get_append_buffer(cq);
429
	
430
	if (len == 0) {
431
		buffer_copy_string(b, "0");
432
	} else {
433
		for (i = 0; i < 8 && len; i++) {
434
			len >>= 4;
435
		}
436
		
437
		/* i is the number of hex digits we have */
438
		buffer_prepare_copy(b, i + 1);
439
		
440
		for (j = i-1, len = olen; j+1 > 0; j--) {
441
			b->ptr[j] = (len & 0xf) + (((len & 0xf) <= 9) ? '0' : 'a' - 10);
442
			len >>= 4;
443
		}
444
		b->used = i;
445
		b->ptr[b->used++] = '\0';
446
	}
447
		
448
	buffer_append_string(b, "\r\n");
449
	/*
450
	chunkqueue_append_buffer(cq, b);
451
	buffer_free(b);
452
	*/
453
	
454
	return 0;
455
}
456

  
457

  
458
int chunk_encode_append_file(chunkqueue *cq, buffer *fn, off_t offset, off_t len) {
459
	if (!cq) return -1;
460
	if (len == 0) return 0;
461
	
462
	chunk_encode_append_len(cq, len);
463
	
464
	chunkqueue_append_file(cq, fn, offset, len);
465
	
466
	chunkqueue_append_mem(cq, "\r\n", 2 + 1);
467
	
468
	return 0;
469
}
470

  
471
int chunk_encode_append_buffer(chunkqueue *cq, buffer *mem) {
472
	if (!cq) return -1;
473
	if (mem->used <= 1) return 0;
474
	
475
	chunk_encode_append_len(cq, mem->used - 1);
476
	
477
	chunkqueue_append_buffer(cq, mem);
478
	
479
	chunkqueue_append_mem(cq, "\r\n", 2 + 1);
480
	
481
	return 0;
482
}
483

  
484
int chunk_encode_append_mem(chunkqueue *cq, const char * mem, size_t len) {
485
	if (!cq) return -1;
486
	if (len <= 1) return 0;
487
	
488
	chunk_encode_append_len(cq, len - 1);
489
	
490
	chunkqueue_append_mem(cq, mem, len);
491
	
492
	chunkqueue_append_mem(cq, "\r\n", 2 + 1);
493
	
494
	return 0;
495
}
496

  
497
int chunk_encode_append_queue(chunkqueue *cq, chunkqueue *src) {
498
	int len = chunkqueue_length(src);
499
	if (!cq) return -1;
500
	if (len == 0) return 0;
501
	
502
	chunk_encode_append_len(cq, len);
503
	
504
	chunkqueue_append_chunkqueue(cq, src);
505
	
506
	chunkqueue_append_mem(cq, "\r\n", 2 + 1);
507
	
508
	return 0;
509
}
510

  
511
int chunk_encode_end(chunkqueue *cq) {
512
	chunk_encode_append_len(cq, 0);
513
	chunkqueue_append_mem(cq, "\r\n", 2 + 1);
514
	return 0;
515
}
lighttpd-1.4.29/src/chunk.h 2011-07-15 20:23:47.237137726 +0100
53 53
int chunkqueue_append_mem(chunkqueue *c, const char *mem, size_t len);
54 54
int chunkqueue_append_buffer(chunkqueue *c, buffer *mem);
55 55
int chunkqueue_append_buffer_weak(chunkqueue *c, buffer *mem);
56
int chunkqueue_append_chunkqueue(chunkqueue *cq, chunkqueue *src);
56 57
int chunkqueue_prepend_buffer(chunkqueue *c, buffer *mem);
57 58

  
58 59
buffer * chunkqueue_get_append_buffer(chunkqueue *c);
......
68 69

  
69 70
int chunkqueue_is_empty(chunkqueue *c);
70 71

  
72
int chunk_encode_append_mem(chunkqueue *cq, const char * mem, size_t len);
73
int chunk_encode_append_buffer(chunkqueue *cq, buffer *mem);
74
int chunk_encode_append_file(chunkqueue *cq, buffer *fn, off_t offset, off_t len);
75
int chunk_encode_append_queue(chunkqueue *cq, chunkqueue *src);
76
int chunk_encode_end(chunkqueue *cq);
77

  
71 78
#endif
lighttpd-1.4.29/src/connections.c 2011-07-15 20:23:47.237137726 +0100
8 8
#include "response.h"
9 9
#include "network.h"
10 10
#include "http_chunk.h"
11
#include "chunk.h"
11 12
#include "stat_cache.h"
12 13
#include "joblist.h"
13 14

  
......
151 152
	return 0;
152 153
}
153 154

  
155
int connection_queue_is_empty(connection *con) {
156
	if(!chunkqueue_is_empty(con->write_queue)) return 0;
157
	if(!chunkqueue_is_empty(con->output_queue)) return 0;
158
	return 1;
159
}
160

  
161

  
154 162
#if 0
155 163
static void dump_packet(const unsigned char *data, size_t len) {
156 164
	size_t i, j;
......
440 448
				con->file_finished = 1;
441 449

  
442 450
				chunkqueue_reset(con->write_queue);
451
				chunkqueue_reset(con->output_queue);
443 452
			}
444 453
			break;
445 454
		default:
......
469 478
		con->response.transfer_encoding &= ~HTTP_TRANSFER_ENCODING_CHUNKED;
470 479
		con->parsed_response &= ~HTTP_CONTENT_LENGTH;
471 480
		chunkqueue_reset(con->write_queue);
481
		chunkqueue_reset(con->output_queue);
472 482

  
473 483
		con->file_finished = 1;
474 484
		break;
......
536 546
		}
537 547
		break;
538 548
	}
549
	
550
	/* Allow filter plugins to change response headers before they are written. */
551
	switch(plugins_call_handle_response_start(srv, con)) {
552
	case HANDLER_GO_ON:
553
	case HANDLER_FINISHED:
554
		/* response start is finished */
555
		break;
556
	default:
557
		/* something strange happend */
558
		log_error_write(srv, __FILE__, __LINE__, "s", "Filter plugin failed.");
559
		connection_set_state(srv, con, CON_STATE_ERROR);
560
		joblist_append(srv, con);
561
		break;
562
	}
563

  
539 564

  
540 565
	if (con->file_finished) {
541 566
		/* we have all the content and chunked encoding is not used, set a content-length */
......
608 633
		con->file_finished = 1;
609 634

  
610 635
		chunkqueue_reset(con->write_queue);
636
		chunkqueue_reset(con->output_queue);
611 637
		con->response.transfer_encoding &= ~HTTP_TRANSFER_ENCODING_CHUNKED;
612 638
	}
613 639

  
......
617 643
}
618 644

  
619 645
static int connection_handle_write(server *srv, connection *con) {
620
	switch(network_write_chunkqueue(srv, con, con->write_queue)) {
646
	int finished = 0;
647
	int len;
648

  
649
	/* Allow filter plugins to modify response conent */
650
	switch(plugins_call_handle_response_filter(srv, con)) {
651
	case HANDLER_GO_ON:
652
		finished = con->file_finished;
653
		/* response content not changed */
654
		break;
655
	case HANDLER_COMEBACK:
656
		/* response filter has more work */
657
		finished = 0;
658
		break;
659
	case HANDLER_FINISHED:
660
		/* response filter is finished */
661
		finished = 1;
662
		break;
663
	default:
664
		/* something strange happend */
665
		log_error_write(srv, __FILE__, __LINE__, "s", "Filter plugin failed.");
666
		connection_set_state(srv, con, CON_STATE_ERROR);
667
		joblist_append(srv, con);
668
		finished = 1;
669
		break;
670
	}
671

  
672
	/* move chunks from write_queue to output_queue. */
673
	if (con->request.http_method == HTTP_METHOD_HEAD) {
674
		chunkqueue_reset(con->write_queue);
675
	} else {
676
		len = chunkqueue_length(con->write_queue);
677
		if(con->response.transfer_encoding & HTTP_TRANSFER_ENCODING_CHUNKED) {
678
			chunk_encode_append_queue(con->output_queue, con->write_queue);
679
			if(finished && !con->end_chunk) {
680
				con->end_chunk = 1;
681
				chunk_encode_end(con->output_queue);
682
			}
683
		} else {
684
			chunkqueue_append_chunkqueue(con->output_queue, con->write_queue);
685
		}
686
		con->write_queue->bytes_out += len;
687
	}
688
	/* write chunks from output_queue to network */
689
	switch(network_write_chunkqueue(srv, con, con->output_queue)) {
621 690
	case 0:
622
		if (con->file_finished) {
691
		if (finished) {
623 692
			connection_set_state(srv, con, CON_STATE_RESPONSE_END);
624 693
			joblist_append(srv, con);
694
		} else {
695
			/* not finished yet -> WRITE */
696
			con->is_writable = 1;
625 697
		}
626 698
		break;
627 699
	case -1: /* error on our side */
......
694 766

  
695 767
#undef CLEAN
696 768
	con->write_queue = chunkqueue_init();
769
	con->output_queue = chunkqueue_init();
697 770
	con->read_queue = chunkqueue_init();
698 771
	con->request_content_queue = chunkqueue_init();
699 772
	chunkqueue_set_tempdirs(con->request_content_queue, srv->srvconf.upload_tempdirs);
......
722 795
		connection_reset(srv, con);
723 796

  
724 797
		chunkqueue_free(con->write_queue);
798
		chunkqueue_free(con->output_queue);
725 799
		chunkqueue_free(con->read_queue);
726 800
		chunkqueue_free(con->request_content_queue);
727 801
		array_free(con->request.headers);
......
779 853
	con->http_status = 0;
780 854
	con->file_finished = 0;
781 855
	con->file_started = 0;
856
	con->end_chunk = 0;
782 857
	con->got_response = 0;
858
	//con->use_cache_file = 0;
859
	//con->write_cache_file = 0;
783 860

  
784 861
	con->parsed_response = 0;
785 862

  
......
852 929
	array_reset(con->environment);
853 930

  
854 931
	chunkqueue_reset(con->write_queue);
932
	chunkqueue_reset(con->output_queue);
855 933
	chunkqueue_reset(con->request_content_queue);
856 934

  
857 935
	/* the plugins should cleanup themself */
......
1242 1320
	}
1243 1321

  
1244 1322
	if (con->state == CON_STATE_WRITE &&
1245
	    !chunkqueue_is_empty(con->write_queue) &&
1246 1323
	    con->is_writable) {
1247 1324

  
1248 1325
		if (-1 == connection_handle_write(srv, con)) {
......
1653 1730
			}
1654 1731

  
1655 1732
			/* only try to write if we have something in the queue */
1656
			if (!chunkqueue_is_empty(con->write_queue)) {
1657 1733
#if 0
1734
			if (!connection_queue_is_empty(con)) {
1658 1735
				log_error_write(srv, __FILE__, __LINE__, "dsd",
1659 1736
						con->fd,
1660 1737
						"packets to write:",
1661
						con->write_queue->used);
1662
#endif
1738
						con->output_queue->used);
1663 1739
			}
1664
			if (!chunkqueue_is_empty(con->write_queue) && con->is_writable) {
1740
#endif
1741
			if (con->is_writable) {
1665 1742
				if (-1 == connection_handle_write(srv, con)) {
1666 1743
					log_error_write(srv, __FILE__, __LINE__, "ds",
1667 1744
							con->fd,
......
1800 1877
		 * - if we have data to write
1801 1878
		 * - if the socket is not writable yet
1802 1879
		 */
1803
		if (!chunkqueue_is_empty(con->write_queue) &&
1804
		    (con->is_writable == 0) &&
1805
		    (con->traffic_limit_reached == 0)) {
1880
		if ((con->is_writable == 0) &&
1881
		    (con->traffic_limit_reached == 0) &&
1882
				!connection_queue_is_empty(con)) {
1806 1883
			fdevent_event_set(srv->ev, &(con->fde_ndx), con->fd, FDEVENT_OUT);
1807 1884
		} else {
1808 1885
			fdevent_event_del(srv->ev, &(con->fde_ndx), con->fd);
lighttpd-1.4.29/src/http_chunk.c 2011-07-15 20:23:47.237137726 +0100
58 58

  
59 59
	cq = con->write_queue;
60 60

  
61
	if (con->response.transfer_encoding & HTTP_TRANSFER_ENCODING_CHUNKED) {
62
		http_chunk_append_len(srv, con, len);
63
	}
64 61

  
65 62
	chunkqueue_append_file(cq, fn, offset, len);
66 63

  
67
	if (con->response.transfer_encoding & HTTP_TRANSFER_ENCODING_CHUNKED && len > 0) {
68
		chunkqueue_append_mem(cq, "\r\n", 2 + 1);
69
	}
70 64

  
71 65
	return 0;
72 66
}
......
78 72

  
79 73
	cq = con->write_queue;
80 74

  
81
	if (con->response.transfer_encoding & HTTP_TRANSFER_ENCODING_CHUNKED) {
82
		http_chunk_append_len(srv, con, mem->used - 1);
83
	}
84 75

  
85 76
	chunkqueue_append_buffer(cq, mem);
86 77

  
87
	if (con->response.transfer_encoding & HTTP_TRANSFER_ENCODING_CHUNKED && mem->used > 0) {
88
		chunkqueue_append_mem(cq, "\r\n", 2 + 1);
89
	}
90 78

  
91 79
	return 0;
92 80
}
......
99 87
	cq = con->write_queue;
100 88

  
101 89
	if (len == 0) {
102
		if (con->response.transfer_encoding & HTTP_TRANSFER_ENCODING_CHUNKED) {
103
			chunkqueue_append_mem(cq, "0\r\n\r\n", 5 + 1);
104
		} else {
105
			chunkqueue_append_mem(cq, "", 1);
106
		}
107 90
		return 0;
108 91
	}
109 92

  
110
	if (con->response.transfer_encoding & HTTP_TRANSFER_ENCODING_CHUNKED) {
111
		http_chunk_append_len(srv, con, len - 1);
112
	}
113 93

  
114 94
	chunkqueue_append_mem(cq, mem, len);
115 95

  
116
	if (con->response.transfer_encoding & HTTP_TRANSFER_ENCODING_CHUNKED) {
117
		chunkqueue_append_mem(cq, "\r\n", 2 + 1);
118
	}
119 96

  
120 97
	return 0;
121 98
}
lighttpd-1.4.29/src/joblist.c 2011-07-15 20:23:47.237137726 +0100
7 7

  
8 8
int joblist_append(server *srv, connection *con) {
9 9
	if (con->in_joblist) return 0;
10
	con->in_joblist = 1;
10 11

  
11 12
	if (srv->joblist->size == 0) {
12 13
		srv->joblist->size  = 16;
lighttpd-1.4.29/src/Makefile.am 2011-07-15 20:23:47.237137726 +0100
265 265
mod_accesslog_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined
266 266
mod_accesslog_la_LIBADD = $(common_libadd)
267 267

  
268
lib_LTLIBRARIES += mod_deflate.la
269
mod_deflate_la_SOURCES = mod_deflate.c 
270
mod_deflate_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined
271
mod_deflate_la_LIBADD = $(Z_LIB) $(BZ_LIB) $(common_libadd)
272

  
268 273

  
269 274
hdr = server.h buffer.h network.h log.h keyvalue.h \
270 275
      response.h request.h fastcgi.h chunk.h \
lighttpd-1.4.29/src/Makefile.in 2011-07-15 20:23:47.237137726 +0100
185 185
	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
186 186
	$(AM_CFLAGS) $(CFLAGS) $(mod_compress_la_LDFLAGS) $(LDFLAGS) \
187 187
	-o $@
188
mod_deflate_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
189
       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
190
am_mod_deflate_la_OBJECTS = mod_deflate.lo
191
mod_deflate_la_OBJECTS = $(am_mod_deflate_la_OBJECTS)
192
mod_deflate_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
193
	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
194
	$(AM_CFLAGS) $(CFLAGS) $(mod_deflate_la_LDFLAGS) $(LDFLAGS) \
195
	-o $@
188 196
mod_dirlisting_la_DEPENDENCIES = $(am__DEPENDENCIES_2) \
189 197
	$(am__DEPENDENCIES_1)
190 198
am_mod_dirlisting_la_OBJECTS = mod_dirlisting.lo
......
449 457
	$(mod_accesslog_la_SOURCES) $(mod_alias_la_SOURCES) \
450 458
	$(mod_auth_la_SOURCES) $(mod_cgi_la_SOURCES) \
451 459
	$(mod_cml_la_SOURCES) $(mod_compress_la_SOURCES) \
460
	$(mod_deflate_la_SOURCES) \
452 461
	$(mod_dirlisting_la_SOURCES) $(mod_evasive_la_SOURCES) \
453 462
	$(mod_evhost_la_SOURCES) $(mod_expire_la_SOURCES) \
454 463
	$(mod_extforward_la_SOURCES) $(mod_fastcgi_la_SOURCES) \
......
677 686
	mod_ssi.la mod_secdownload.la mod_expire.la mod_evhost.la \
678 687
	mod_simple_vhost.la mod_fastcgi.la mod_extforward.la \
679 688
	mod_access.la mod_compress.la mod_auth.la mod_rewrite.la \
680
	mod_redirect.la mod_status.la mod_accesslog.la
689
	mod_redirect.la mod_status.la mod_accesslog.la mod_deflate.la
681 690
@NO_RDYNAMIC_TRUE@liblightcomp_la_SOURCES = $(common_src)
682 691
@NO_RDYNAMIC_TRUE@liblightcomp_la_CFLAGS = $(AM_CFLAGS) $(LIBEV_CFLAGS)
683 692
@NO_RDYNAMIC_TRUE@liblightcomp_la_LDFLAGS = -avoid-version -no-undefined
......
784 793
mod_accesslog_la_SOURCES = mod_accesslog.c
785 794
mod_accesslog_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined
786 795
mod_accesslog_la_LIBADD = $(common_libadd)
796
mod_deflate_la_SOURCES = mod_deflate.c 
797
mod_deflate_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined
798
mod_deflate_la_LIBADD = $(Z_LIB) $(BZ_LIB) $(common_libadd)
787 799
hdr = server.h buffer.h network.h log.h keyvalue.h \
788 800
      response.h request.h fastcgi.h chunk.h \
789 801
      settings.h http_chunk.h http_auth_digest.h \
......
902 914
	$(AM_V_CCLD)$(mod_cml_la_LINK) -rpath $(libdir) $(mod_cml_la_OBJECTS) $(mod_cml_la_LIBADD) $(LIBS)
903 915
mod_compress.la: $(mod_compress_la_OBJECTS) $(mod_compress_la_DEPENDENCIES) 
904 916
	$(AM_V_CCLD)$(mod_compress_la_LINK) -rpath $(libdir) $(mod_compress_la_OBJECTS) $(mod_compress_la_LIBADD) $(LIBS)
917
mod_deflate.la: $(mod_deflate_la_OBJECTS) $(mod_deflate_la_DEPENDENCIES) 
918
	$(AM_V_CCLD)$(mod_deflate_la_LINK) -rpath $(libdir) $(mod_deflate_la_LDFLAGS) $(mod_deflate_la_OBJECTS) $(mod_deflate_la_LIBADD) $(LIBS)
905 919
mod_dirlisting.la: $(mod_dirlisting_la_OBJECTS) $(mod_dirlisting_la_DEPENDENCIES) 
906 920
	$(AM_V_CCLD)$(mod_dirlisting_la_LINK) -rpath $(libdir) $(mod_dirlisting_la_OBJECTS) $(mod_dirlisting_la_LIBADD) $(LIBS)
907 921
mod_evasive.la: $(mod_evasive_la_OBJECTS) $(mod_evasive_la_DEPENDENCIES) 
......
1108 1122
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_cml_la-mod_cml_funcs.Plo@am__quote@
1109 1123
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_cml_la-mod_cml_lua.Plo@am__quote@
1110 1124
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_compress.Plo@am__quote@
1125
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_deflate.Plo@am__quote@
1111 1126
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_dirlisting.Plo@am__quote@
1112 1127
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_evasive.Plo@am__quote@
1113 1128
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_evhost.Plo@am__quote@
lighttpd-1.4.29/src/plugin.c 2011-07-15 20:23:47.241137541 +0100
37 37
		PLUGIN_FUNC_HANDLE_SIGHUP,
38 38
		PLUGIN_FUNC_HANDLE_SUBREQUEST,
39 39
		PLUGIN_FUNC_HANDLE_SUBREQUEST_START,
40
		PLUGIN_FUNC_HANDLE_RESPONSE_START,
41
		PLUGIN_FUNC_HANDLE_RESPONSE_FILTER,
40 42
		PLUGIN_FUNC_HANDLE_JOBLIST,
41 43
		PLUGIN_FUNC_HANDLE_DOCROOT,
42 44
		PLUGIN_FUNC_HANDLE_PHYSICAL,
......
270 272
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_CONNECTION_CLOSE, handle_connection_close)
271 273
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_SUBREQUEST, handle_subrequest)
272 274
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_SUBREQUEST_START, handle_subrequest_start)
275
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_RESPONSE_START, handle_response_start)
276
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_RESPONSE_FILTER, handle_response_filter)
273 277
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_JOBLIST, handle_joblist)
274 278
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_DOCROOT, handle_docroot)
275 279
PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_PHYSICAL, handle_physical)
......
399 403
		PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_SIGHUP, handle_sighup);
400 404
		PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_SUBREQUEST, handle_subrequest);
401 405
		PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_SUBREQUEST_START, handle_subrequest_start);
406
		PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_RESPONSE_START, handle_response_start);
407
		PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_RESPONSE_FILTER, handle_response_filter);
402 408
		PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_JOBLIST, handle_joblist);
403 409
		PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_DOCROOT, handle_docroot);
404 410
		PLUGIN_TO_SLOT(PLUGIN_FUNC_HANDLE_PHYSICAL, handle_physical);
lighttpd-1.4.29/src/plugin.h 2011-07-15 20:23:47.241137541 +0100
54 54
											    * has to be found
55 55
											    */
56 56
	handler_t (* handle_subrequest)      (server *srv, connection *con, void *p_d);    /* */
57
	handler_t (* handle_response_start)  (server *srv, connection *con, void *p_d);    /* before response headers are written */
58
	handler_t (* handle_response_filter) (server *srv, connection *con, void *p_d);    /* response content filter */
57 59
	handler_t (* connection_reset)       (server *srv, connection *con, void *p_d);    /* */
58 60
	void *data;
59 61

  
......
68 70
handler_t plugins_call_handle_uri_clean(server *srv, connection *con);
69 71
handler_t plugins_call_handle_subrequest_start(server *srv, connection *con);
70 72
handler_t plugins_call_handle_subrequest(server *srv, connection *con);
73
handler_t plugins_call_handle_response_start(server *srv, connection *con);
74
handler_t plugins_call_handle_response_filter(server *srv, connection *con);
71 75
handler_t plugins_call_handle_request_done(server *srv, connection *con);
72 76
handler_t plugins_call_handle_docroot(server *srv, connection *con);
73 77
handler_t plugins_call_handle_physical(server *srv, connection *con);
lighttpd-1.4.29/src/request.c 2011-07-15 20:23:47.241137541 +0100
425 425

  
426 426
					if (major_num == 1 && minor_num == 1) {
427 427
						con->request.http_version = con->conf.allow_http11 ? HTTP_VERSION_1_1 : HTTP_VERSION_1_0;
428
						con->request.true_http_10_client = 0;
428 429
					} else if (major_num == 1 && minor_num == 0) {
429 430
						con->request.http_version = HTTP_VERSION_1_0;
431
						con->request.true_http_10_client = 1;
430 432
					} else {
431 433
						con->http_status = 505;
432 434

  
lighttpd-1.4.29/src/response.c 2011-07-15 20:23:47.241137541 +0100
33 33
	int have_date = 0;
34 34
	int have_server = 0;
35 35

  
36
	b = chunkqueue_get_prepend_buffer(con->write_queue);
36
	b = chunkqueue_get_prepend_buffer(con->output_queue);
37 37

  
38 38
	if (con->request.http_version == HTTP_VERSION_1_1) {
39 39
		buffer_copy_string_len(b, CONST_STR_LEN("HTTP/1.1 "));
......
76 76
			if (0 == strcasecmp(ds->key->ptr, "Date")) have_date = 1;
77 77
			if (0 == strcasecmp(ds->key->ptr, "Server")) have_server = 1;
78 78
			if (0 == strcasecmp(ds->key->ptr, "Content-Encoding") && 304 == con->http_status) continue;
79
			
80
			/* remove Transfer-Encoding: chunked header when HTTP 1.0
81
			 * or transfer_encoding & HTTP_TRANSFER_ENCODING_CHUNKED == 0
82
			 */
83
			if ( (con->request.http_version == HTTP_VERSION_1_0 || 
84
			     !(con->response.transfer_encoding & HTTP_TRANSFER_ENCODING_CHUNKED)) &&
85
			     0 == strncasecmp(ds->value->ptr, "chunked", sizeof("chunked")-1) &&
86
			     0 == strncasecmp(ds->key->ptr, "Transfer-Encoding", sizeof("Transfer-Encoding") - 1)) {
87
				continue ;
88
			}
89

  
79 90

  
80 91
			buffer_append_string_len(b, CONST_STR_LEN("\r\n"));
81 92
			buffer_append_string_buffer(b, ds->key);
......
664 675
				}
665 676

  
666 677
				if (slash) pathinfo = slash;
667
			} while ((found == 0) && (slash != NULL) && ((size_t)(slash - srv->tmp_buf->ptr) > (con->physical.basedir->used - 2)));
678
			} while ((found == 0) && (slash != NULL) && ((size_t)(slash - srv->tmp_buf->ptr) > con->physical.basedir->used - 2));
668 679

  
669 680
			if (found == 0) {
670 681
				/* no it really doesn't exists */
lighttpd-1.4.29/src/server.c 2011-07-15 20:23:47.241137541 +0100
234 234

  
235 235
	srv->joblist = calloc(1, sizeof(*srv->joblist));
236 236
	assert(srv->joblist);
237
	
238
	srv->joblist_prev = calloc(1, sizeof(*srv->joblist));
239
	assert(srv->joblist_prev);
237 240

  
238 241
	srv->fdwaitqueue = calloc(1, sizeof(*srv->fdwaitqueue));
239 242
	assert(srv->fdwaitqueue);
......
331 334
#undef CLEAN
332 335

  
333 336
	joblist_free(srv, srv->joblist);
337
	joblist_free(srv, srv->joblist_prev);
334 338
	fdwaitqueue_free(srv, srv->fdwaitqueue);
335 339

  
336 340
	if (srv->stat_cache) {
......
1174 1178
	/* main-loop */
1175 1179
	while (!srv_shutdown) {
1176 1180
		int n;
1181
		int timeout;
1177 1182
		size_t ndx;
1178 1183
		time_t min_ts;
1179 1184

  
......
1430 1435
			}
1431 1436
		}
1432 1437

  
1433
		if ((n = fdevent_poll(srv->ev, 1000)) > 0) {
1438
		if(srv->joblist->used > 0) {
1439
			timeout = 500;
1440
		} else {
1441
			timeout = 1000;
1442
		}
1443
		if ((n = fdevent_poll(srv->ev, timeout)) > 0) {
1434 1444
			/* n is the number of events */
1435 1445
			int revents;
1436 1446
			int fd_ndx;
......
1480 1490
					strerror(errno));
1481 1491
		}
1482 1492

  
1483
		for (ndx = 0; ndx < srv->joblist->used; ndx++) {
1484
			connection *con = srv->joblist->ptr[ndx];
1493
		if(srv->joblist->used > 0) {
1494
			connections *joblist = srv->joblist;
1495
			/* switch joblist queues. */
1496
			srv->joblist = srv->joblist_prev;
1497
			srv->joblist_prev = joblist;
1498
			for (ndx = 0; ndx < joblist->used; ndx++) {
1499
				connection *con = joblist->ptr[ndx];
1485 1500
			handler_t r;
1486 1501

  
1502
			con->in_joblist = 0;
1487 1503
			connection_state_machine(srv, con);
1488 1504

  
1489 1505
			switch(r = plugins_call_handle_joblist(srv, con)) {
......
1495 1511
				break;
1496 1512
			}
1497 1513

  
1498
			con->in_joblist = 0;
1499 1514
		}
1500 1515

  
1501
		srv->joblist->used = 0;
1516
			joblist->used = 0;
1517
		}
1502 1518
	}
1503 1519

  
1504 1520
	if (srv->srvconf.pid_file->used &&