Author: glen Date: Tue Jun 17 15:56:27 2008 GMT Module: SOURCES Tag: HEAD ---- Log message: - update to 2129: - Fix conditional interpretation of core options - Enable escaping of % and $ in redirect/rewrite; only two cases changed their behaviour: "%%" => "%", "$$" => "$" - Fix accesslog port (should be port from the connection, not the "server.port") (#1618) - Fix mod_fastcgi prefix matching: match the prefix always against url, not the absolute filepath (regardless of check-local) - Overwrite Content-Type header in mod_dirlisting instead of inserting (#1614), patch by Henrik Holst - Handle EINTR in mod_cgi during write() (#1640) - Allow all http status codes by default; disable body only for 204,205 and 304; generate error pages for 4xx and 5xx (#1639) - Fix mod_magnet to set con->mode = p->id if it generates content, so returning 4xx/5xx doesn't append an error page - Remove lighttpd.spec* from source, fixing all problems with it ;-) - Do not rely on PATH_MAX (POSIX does not require it) (#580) - Disable logging to access.log if filename is an empty string - Implement a clean way to open /dev/null and use it to close stdin/out/err in the needed places (#624)
---- Files affected: SOURCES: lighttpd-branch.diff (1.33 -> 1.34) ---- Diffs: ================================================================ Index: SOURCES/lighttpd-branch.diff diff -u SOURCES/lighttpd-branch.diff:1.33 SOURCES/lighttpd-branch.diff:1.34 --- SOURCES/lighttpd-branch.diff:1.33 Thu Apr 10 20:36:36 2008 +++ SOURCES/lighttpd-branch.diff Tue Jun 17 17:56:21 2008 @@ -1,9 +1,114 @@ +Index: lighttpd.spec.in +=================================================================== +--- lighttpd.spec.in (.../tags/lighttpd-1.4.19) (revision 2190) ++++ lighttpd.spec.in (.../branches/lighttpd-1.4.x) (revision 2190) +@@ -1,83 +0,0 @@ +-Summary: A fast webserver with minimal memory-footprint (lighttpd) +-Name: lighttpd +-Version: @VERSION@ +-Release: 1 +-Source: http://jan.kneschke.de/projects/lighttpd/download/lighttpd-%version.tar.gz +-Packager: Jan Kneschke <[EMAIL PROTECTED]> +-License: BSD +-Group: Networking/Daemons +-URL: http://www.lighttpd.net/ +-Requires: pcre >= 3.1 zlib +-BuildRequires: libtool zlib-devel +-BuildRoot: %{_tmppath}/%{name}-root +- +-%description +-lighttpd is intented to be a frontend for ad-servers which have to deliver +-small files concurrently to many connections. +- +-Available rpmbuild rebuild options: +---with: ssl mysql lua memcache +- +-%prep +-%setup -q +- +-%build +-rm -rf %{buildroot} +-%configure \ +- %{?_with_mysql: --with-mysql} \ +- %{?_with_lua: --with-lua} \ +- %{?_with_memcache: --with-memcache} \ +- %{?_with_ssl: --with-openssl} +-make +- +-%install +-%makeinstall +- +-mkdir -p %{buildroot}%{_sysconfdir}/{init.d,sysconfig} +-if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then +- install -m 755 doc/rc.lighttpd.redhat %{buildroot}%{_sysconfdir}/init.d/lighttpd +-else +- install -m 755 doc/rc.lighttpd %{buildroot}%{_sysconfdir}/init.d/lighttpd +-fi +-install -m 644 doc/sysconfig.lighttpd %{buildroot}%{_sysconfdir}/sysconfig/lighttpd +- +-%clean +-rm -rf %{buildroot} +- +-%post +-## read http://www.fedora.us/docs/spec.html next time :) +-if [ "$1" = "1" ]; then +- # real install, not upgrade +- /sbin/chkconfig --add lighttpd +-fi +- +-%preun +-if [ "$1" = "0"]; then +- # real uninstall, not upgrade +- %{_sysconfdir}/init.d/lighttpd stop +- /sbin/chkconfig --del lighttpd +-fi +- +-%files +-%defattr(-,root,root) +-%doc doc/lighttpd.conf doc/lighttpd.user README INSTALL ChangeLog COPYING AUTHORS +-%doc doc/*.txt +-%config(noreplace) %attr(0755,root,root) %{_sysconfdir}/init.d/lighttpd +-%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/sysconfig/lighttpd +-%{_mandir}/* +-%{_libdir}/* +-%{_sbindir}/* +-%{_bindir}/* +- +-%changelog +-* Thu Sep 30 2004 12:41 <[EMAIL PROTECTED]> 1.3.1 +-- upgraded to 1.3.1 +- +-* Tue Jun 29 2004 17:26 <[EMAIL PROTECTED]> 1.2.3 +-- rpmlint'ed the package +-- added URL +-- added (noreplace) to start-script +-- change group to Networking/Daemon (like apache) +- +-* Sun Feb 23 2003 15:04 <[EMAIL PROTECTED]> +-- initial version Index: configure.in =================================================================== +Index: src/mod_ssi_exprparser.h +=================================================================== +--- src/mod_ssi_exprparser.h (.../tags/lighttpd-1.4.19) (revision 2190) ++++ src/mod_ssi_exprparser.h (.../branches/lighttpd-1.4.x) (revision 2190) +@@ -1,12 +0,0 @@ +-#define TK_AND 1 +-#define TK_OR 2 +-#define TK_EQ 3 +-#define TK_NE 4 +-#define TK_GT 5 +-#define TK_GE 6 +-#define TK_LT 7 +-#define TK_LE 8 +-#define TK_NOT 9 +-#define TK_LPARAN 10 +-#define TK_RPARAN 11 +-#define TK_VALUE 12 Index: src/configfile-glue.c =================================================================== ---- src/configfile-glue.c (.../tags/lighttpd-1.4.19) (revision 2145) -+++ src/configfile-glue.c (.../branches/lighttpd-1.4.x) (revision 2145) +--- src/configfile-glue.c (.../tags/lighttpd-1.4.19) (revision 2190) ++++ src/configfile-glue.c (.../branches/lighttpd-1.4.x) (revision 2190) @@ -529,7 +529,7 @@ int config_append_cond_match_buffer(connection *con, data_config *dc, buffer *buf, int n) { @@ -13,10 +118,138 @@ return 0; } +Index: src/mod_cgi.c +=================================================================== +--- src/mod_cgi.c (.../tags/lighttpd-1.4.19) (revision 2190) ++++ src/mod_cgi.c (.../branches/lighttpd-1.4.x) (revision 2190) +@@ -987,6 +987,8 @@ + *c = '/'; + } + ++ openDevNull(STDERR_FILENO); ++ + /* we don't need the client socket */ + for (i = 3; i < 256; i++) { + if (i != srv->errorlog_fd) close(i); +@@ -995,7 +997,7 @@ + /* exec the cgi */ + execve(args[0], args, env.ptr); + +- log_error_write(srv, __FILE__, __LINE__, "sss", "CGI failed:", strerror(errno), args[0]); ++ /* log_error_write(srv, __FILE__, __LINE__, "sss", "CGI failed:", strerror(errno), args[0]); */ + + /* */ + SEGFAULT(); +@@ -1058,8 +1060,9 @@ + switch(errno) { + case ENOSPC: + con->http_status = 507; +- + break; ++ case EINTR: ++ continue; + default: + con->http_status = 403; + break; +@@ -1071,8 +1074,9 @@ + switch(errno) { + case ENOSPC: + con->http_status = 507; +- + break; ++ case EINTR: ++ continue; + default: + con->http_status = 403; + break; +@@ -1087,6 +1091,8 @@ + c->offset += r; + cq->bytes_out += r; + } else { ++ log_error_write(srv, __FILE__, __LINE__, "ss", "write() failed due to: ", strerror(errno)); ++ con->http_status = 500; + break; + } + chunkqueue_remove_finished_chunks(cq); +Index: src/mod_rewrite.c +=================================================================== +--- src/mod_rewrite.c (.../tags/lighttpd-1.4.19) (revision 2190) ++++ src/mod_rewrite.c (.../branches/lighttpd-1.4.x) (revision 2190) +@@ -385,8 +385,7 @@ + + start = 0; end = pattern_len; + for (k = 0; k < pattern_len; k++) { +- if ((pattern[k] == '$' || pattern[k] == '%') && +- isdigit((unsigned char)pattern[k + 1])) { ++ if (pattern[k] == '$' || pattern[k] == '%') { + /* got one */ + + size_t num = pattern[k + 1] - '0'; +@@ -395,7 +394,10 @@ + + buffer_append_string_len(con->request.uri, pattern + start, end - start); + +- if (pattern[k] == '$') { ++ if (!isdigit((unsigned char)pattern[k + 1])) { ++ /* enable escape: "%%" => "%", "%a" => "%a", "$$" => "$" */ ++ buffer_append_string_len(con->request.uri, pattern+k, pattern[k] == pattern[k+1] ? 1 : 2); ++ } else if (pattern[k] == '$') { + /* n is always > 0 */ + if (num < (size_t)n) { + buffer_append_string(con->request.uri, list[num]); +Index: src/lempar.c +=================================================================== +--- src/lempar.c (.../tags/lighttpd-1.4.19) (revision 2190) ++++ src/lempar.c (.../branches/lighttpd-1.4.x) (revision 2190) +@@ -210,7 +210,7 @@ + */ + const char *ParseTokenName(int tokenType){ + #ifndef NDEBUG +- if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ ++ if( tokenType>0 && (size_t)tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ + return yyTokenName[tokenType]; + }else{ + return "Unknown"; +@@ -335,7 +335,7 @@ + return YY_NO_ACTION; + } + i += iLookAhead; +- if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ ++ if( i<0 || (size_t)i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ + #ifdef YYFALLBACK + int iFallback; /* Fallback token */ + if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0]) +@@ -378,7 +378,7 @@ + return YY_NO_ACTION; + } + i += iLookAhead; +- if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ ++ if( i<0 || (size_t)i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ + return yy_default[stateno]; + }else{ + return yy_action[i]; +@@ -456,7 +456,7 @@ + yymsp = &yypParser->yystack[yypParser->yyidx]; + #ifndef NDEBUG + if( yyTraceFILE && yyruleno>=0 +- && yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){ ++ && (size_t)yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){ + fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt, + yyRuleName[yyruleno]); + } +@@ -511,6 +511,8 @@ + int yymajor, /* The major type of the error token */ + YYMINORTYPE yyminor /* The minor type of the error token */ + ){ ++ UNUSED(yymajor); ++ UNUSED(yyminor); + ParseARG_FETCH; + #define TOKEN (yyminor.yy0) + %% Index: src/connections.c =================================================================== ---- src/connections.c (.../tags/lighttpd-1.4.19) (revision 2145) -+++ src/connections.c (.../branches/lighttpd-1.4.x) (revision 2145) +--- src/connections.c (.../tags/lighttpd-1.4.19) (revision 2190) ++++ src/connections.c (.../branches/lighttpd-1.4.x) (revision 2190) @@ -199,6 +199,7 @@ /* don't resize the buffer if we were in SSL_ERROR_WANT_* */ @@ -25,7 +258,111 @@ do { if (!con->ssl_error_want_reuse_buffer) { b = buffer_init(); -@@ -1668,21 +1669,51 @@ +@@ -299,6 +300,8 @@ + + return 0; + #else ++ UNUSED(srv); ++ UNUSED(con); + return -1; + #endif + } +@@ -427,21 +430,22 @@ + } + + switch(con->http_status) { +- case 400: /* class: header + custom body */ +- case 401: +- case 403: +- case 404: +- case 408: +- case 409: +- case 411: +- case 416: +- case 423: +- case 500: +- case 501: +- case 503: +- case 505: ++ case 204: /* class: header only */ ++ case 205: ++ case 304: ++ /* disable chunked encoding again as we have no body */ ++ con->response.transfer_encoding &= ~HTTP_TRANSFER_ENCODING_CHUNKED; ++ con->parsed_response &= ~HTTP_CONTENT_LENGTH; ++ chunkqueue_reset(con->write_queue); ++ ++ con->file_finished = 1; ++ break; ++ default: /* class: header + body */ + if (con->mode != DIRECT) break; + ++ /* only custom body for 4xx and 5xx */ ++ if (con->http_status < 400 || con->http_status >= 600) break; ++ + con->file_finished = 0; + + buffer_reset(con->physical.path); +@@ -451,7 +455,8 @@ + stat_cache_entry *sce = NULL; + + buffer_copy_string_buffer(con->physical.path, con->conf.errorfile_prefix); +- buffer_append_string(con->physical.path, get_http_status_body_name(con->http_status)); ++ buffer_append_long(con->physical.path, con->http_status); ++ buffer_append_string_len(con->physical.path, CONST_STR_LEN(".html")); + + if (HANDLER_ERROR != stat_cache_get_entry(srv, con, con->physical.path, &sce)) { + con->file_finished = 1; +@@ -497,30 +502,7 @@ + + response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("text/html")); + } +- /* fall through */ +- case 207: +- case 200: /* class: header + body */ +- case 201: +- case 300: +- case 301: +- case 302: +- case 303: +- case 307: + break; +- +- case 206: /* write_queue is already prepared */ +- break; +- case 204: +- case 205: /* class: header only */ +- case 304: +- default: +- /* disable chunked encoding again as we have no body */ +- con->response.transfer_encoding &= ~HTTP_TRANSFER_ENCODING_CHUNKED; +- con->parsed_response &= ~HTTP_CONTENT_LENGTH; +- chunkqueue_reset(con->write_queue); +- +- con->file_finished = 1; +- break; + } + + if (con->file_finished) { +@@ -544,7 +526,7 @@ + data_string *ds; + /* no Content-Body, no Content-Length */ + if (NULL != (ds = (data_string*) array_get_element(con->response.headers, "Content-Length"))) { +- buffer_reset(ds->value); // Headers with empty values are ignored for output ++ buffer_reset(ds->value); /* Headers with empty values are ignored for output */ + } + } else if (qlen > 0 || con->request.http_method != HTTP_METHOD_HEAD) { + /* qlen = 0 is important for Redirects (301, ...) as they MAY have +@@ -846,7 +828,7 @@ + } + + /* The cond_cache gets reset in response.c */ +-// config_cond_cache_reset(srv, con); ++ /* config_cond_cache_reset(srv, con); */ + + #ifdef USE_OPENSSL + if (con->ssl_error_want_reuse_buffer) { +@@ -1668,21 +1650,51 @@ } #ifdef USE_OPENSSL if (srv_sock->is_ssl) { @@ -84,10 +421,510 @@ #endif switch(con->mode) { +Index: src/configfile.c +=================================================================== +--- src/configfile.c (.../tags/lighttpd-1.4.19) (revision 2190) ++++ src/configfile.c (.../branches/lighttpd-1.4.x) (revision 2190) +@@ -7,6 +7,7 @@ + #include <string.h> + #include <stdio.h> + #include <ctype.h> ++#include <limits.h> + #include <assert.h> + + #include "server.h" +@@ -305,9 +306,6 @@ + data_config *dc = (data_config *)srv->config_context->data[i]; + specific_config *s = srv->config_storage[i]; + +- /* not our stage */ +- if (comp != dc->comp) continue; +- + /* condition didn't match */ + if (!config_check_cond(srv, con, dc)) continue; + +@@ -410,8 +408,8 @@ + + #if 0 + static int tokenizer_open(server *srv, tokenizer_t *t, buffer *basedir, const char *fn) { +- if (buffer_is_empty(basedir) && +- (fn[0] == '/' || fn[0] == '\\') && ++ if (buffer_is_empty(basedir) || ++ (fn[0] == '/' || fn[0] == '\\') || + (fn[0] == '.' && (fn[1] == '/' || fn[1] == '\\'))) { + t->file = buffer_init_string(fn); + } else { +@@ -884,8 +882,8 @@ + int ret; + buffer *filename; + +- if (buffer_is_empty(context->basedir) && +- (fn[0] == '/' || fn[0] == '\\') && ++ if (buffer_is_empty(context->basedir) || ++ (fn[0] == '/' || fn[0] == '\\') || + (fn[0] == '.' && (fn[1] == '/' || fn[1] == '\\'))) { + filename = buffer_init_string(fn); + } else { +@@ -912,15 +910,39 @@ + return ret; + } + ++static char* getCWD() { ++ char *s, *s1; ++ size_t len; ++#ifdef PATH_MAX ++ len = PATH_MAX; ++#else ++ len = 4096; ++#endif ++ ++ s = malloc(len); ++ if (!s) return NULL; ++ while (NULL == getcwd(s, len)) { ++ if (errno != ERANGE || SSIZE_MAX - len < len) return NULL; ++ len *= 2; ++ s1 = realloc(s, len); ++ if (!s1) { ++ free(s); ++ return NULL; ++ } ++ s = s1; ++ } ++ return s; ++} ++ + int config_parse_cmd(server *srv, config_t *context, const char *cmd) { + proc_handler_t proc; + tokenizer_t t; + int ret; + buffer *source; + buffer *out; +- char oldpwd[PATH_MAX]; ++ char *oldpwd; + +- if (NULL == getcwd(oldpwd, sizeof(oldpwd))) { ++ if (NULL == (oldpwd = getCWD())) { + log_error_write(srv, __FILE__, __LINE__, "s", + "cannot get cwd", strerror(errno)); + return -1; +@@ -945,6 +967,7 @@ + buffer_free(source); + buffer_free(out); + chdir(oldpwd); ++ free(oldpwd); + return ret; + } + +Index: src/lemon.c +=================================================================== +--- src/lemon.c (.../tags/lighttpd-1.4.19) (revision 2190) ++++ src/lemon.c (.../branches/lighttpd-1.4.x) (revision 2190) +@@ -12,6 +12,19 @@ + #include <ctype.h> + #include <stdlib.h> + ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#ifdef HAVE_STDINT_H ++# include <stdint.h> ++#endif ++#ifdef HAVE_INTTYPES_H ++# include <inttypes.h> ++#endif ++ ++#define UNUSED(x) ( (void)(x) ) ++ + extern void qsort(); + extern double strtod(); + extern long strtol(); +@@ -983,6 +996,7 @@ + { + struct symbol *spx, *spy; + int errcnt = 0; ++ UNUSED(errsym); + assert( apx->sp==apy->sp ); /* Otherwise there would be no conflict */ + if( apx->type==SHIFT && apy->type==REDUCE ){ + spx = apx->sp; +@@ -1347,6 +1361,7 @@ + struct lemon lem; + char *def_tmpl_name = "lempar.c"; + ++ UNUSED(argc); + OptInit(argv,options,stderr); + if( version ){ + printf("Lemon version 1.0\n"); +@@ -1651,7 +1666,7 @@ + }else if( op[j].type==OPT_FLAG ){ + *((int*)op[j].arg) = v; + }else if( op[j].type==OPT_FFLAG ){ +- (*(void(*)())(op[j].arg))(v); ++ (*(void(*)())(intptr_t)(op[j].arg))(v); + }else{ + if( err ){ + fprintf(err,"%smissing argument on switch.\n",emsg); +@@ -1733,19 +1748,19 @@ + *(double*)(op[j].arg) = dv; + break; + case OPT_FDBL: +- (*(void(*)())(op[j].arg))(dv); ++ (*(void(*)())(intptr_t)(op[j].arg))(dv); + break; + case OPT_INT: + *(int*)(op[j].arg) = lv; + break; + case OPT_FINT: +- (*(void(*)())(op[j].arg))((int)lv); ++ (*(void(*)())(intptr_t)(op[j].arg))((int)lv); + break; + case OPT_STR: + *(char**)(op[j].arg) = sv; + break; + case OPT_FSTR: +- (*(void(*)())(op[j].arg))(sv); ++ (*(void(*)())(intptr_t)(op[j].arg))(sv); + break; + } + } +@@ -2286,10 +2301,10 @@ + ** token is passed to the function "parseonetoken" which builds all + ** the appropriate data structures in the global state vector "gp". + */ ++struct pstate ps; + void Parse(gp) + struct lemon *gp; + { +- struct pstate ps; + FILE *fp; + char *filebuf; + size_t filesize; +Index: src/mod_scgi.c +=================================================================== +--- src/mod_scgi.c (.../tags/lighttpd-1.4.19) (revision 2190) ++++ src/mod_scgi.c (.../branches/lighttpd-1.4.x) (revision 2190) +@@ -202,6 +202,15 @@ + * + */ + ++ /* ++ * workaround for program when prefix="/" ++ * ++ * rule to build PATH_INFO is hardcoded for when check_local is disabled ++ * enable this option to use the workaround ++ * ++ */ ++ ++ unsigned short fix_root_path_name; + ssize_t load; /* replace by host->load */ + + size_t max_id; /* corresponds most of the time to +@@ -233,6 +242,7 @@ + typedef struct { + buffer *key; /* like .php */ + ++ int note_is_sent; + scgi_extension_host **hosts; + + size_t used; +@@ -968,6 +978,7 @@ + + { "bin-environment", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 11 */ + { "bin-copy-environment", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 12 */ ++ { "fix-root-scriptname", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 13 */ + + + { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET } +@@ -990,6 +1001,7 @@ + df->max_load_per_proc = 1; + df->idle_timeout = 60; <<Diff was trimmed, longer than 597 lines>> ---- CVS-web: http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/lighttpd-branch.diff?r1=1.33&r2=1.34&f=u _______________________________________________ pld-cvs-commit mailing list [email protected] http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
