Project

General

Profile

lighttpd.ssi.patch

updated patch for lighttpd 1.4.11 -- dhazeghi - Anonymous, 2006-06-04 18:36

View differences:

mod_ssi.c 2006-06-04 11:33:16.000000000 -0700
286 286
	return 0;
287 287
}
288 288

  
289
URIHANDLER_FUNC(mod_ssi_physical_path);
290

  
289 291
static int process_ssi_stmt(server *srv, connection *con, plugin_data *p, 
290 292
			    const char **l, size_t n) {
291 293
	size_t i, ssicmd = 0;
......
546 548
		}
547 549
		
548 550
		if (0 == stat(p->stat_fn->ptr, &st)) {
551
			buffer *tmp;
549 552
			time_t t = st.st_mtime;
550 553
			
551 554
			switch (ssicmd) {
......
574 577
				}
575 578
				break;
576 579
			case SSI_INCLUDE:
577
				chunkqueue_append_file(con->write_queue, p->stat_fn, 0, st.st_size);
578
				break;
580
				/* do recursive SSI expansion */
581
				
582
				/* prevents infinite loop */
583
				if (con->loops_per_request > 25 || buffer_is_equal(con->physical.path, p->stat_fn)) {
584
					buffer_copy_string(srv->tmp_buf, "<!-- your include directives create an infinite loop; aborting -->");
585
					chunkqueue_append_buffer(con->write_queue, srv->tmp_buf);
586
					break;
587
				}
588

  
589
				tmp = buffer_init();
590
				buffer_copy_string_buffer(tmp, con->physical.path); /* save path of current document */
591
				buffer_copy_string_buffer(con->physical.path, p->stat_fn); /* next sub-document to parse */
592
				if (mod_ssi_physical_path(srv,con,p) != HANDLER_FINISHED) {
593
					/* the document was not processed, so write it as is */
594
					chunkqueue_append_file(con->write_queue, con->physical.path, 0, st.st_size);
595
				}
596
				buffer_copy_string_buffer(con->physical.path, tmp); /* restore saved path */
597
				buffer_free(tmp);
598
			break;
579 599
			}
580 600
		} else {
581 601
			log_error_write(srv, __FILE__, __LINE__, "sbs",
......
1044 1064
	
1045 1065
	if (con->physical.path->used == 0) return HANDLER_GO_ON;
1046 1066
	
1067
	con->loops_per_request++;
1068
	
1047 1069
	mod_ssi_patch_connection(srv, con, p);
1048 1070
	
1049 1071
	for (k = 0; k < p->conf.ssi_extension->used; k++) {