From 1b24d86e6b2179692e60091dec59f797cd308b9e Mon Sep 17 00:00:00 2001 From: Arno Töll Date: Wed, 21 Nov 2012 23:03:42 +0100 Subject: Imported Upstream version 1.4.13 --- COPYING | 20 +- ChangeLog | 1516 ++++++++++++++-------------- INSTALL | 2 +- Makefile.am | 2 +- Makefile.in | 4 +- NEWS | 94 +- README | 24 +- config.h.in | 12 + configure | 363 +++---- configure.in | 90 +- cygwin/Makefile.in | 2 +- cygwin/lighttpd.README | 228 ++--- cygwin/lighttpd.README.in | 228 ++--- distribute.sh.in | 8 +- doc/Makefile.am | 14 +- doc/Makefile.in | 10 +- doc/access.txt | 6 +- doc/accesslog.txt | 46 +- doc/alias.txt | 8 +- doc/authentication.txt | 104 +- doc/cgi.txt | 8 +- doc/cml.txt | 48 +- doc/compress.txt | 18 +- doc/configuration.txt | 160 +-- doc/dirlisting.txt | 8 +- doc/evhost.txt | 12 +- doc/expire.txt | 12 +- doc/fastcgi-state.txt | 10 +- doc/fastcgi.txt | 326 +++--- doc/features.txt | 58 +- doc/magnet.txt | 429 ++++++++ doc/performance.txt | 8 +- doc/plugins.txt | 88 +- doc/proxy.txt | 40 +- doc/rc.lighttpd | 12 +- doc/redirect.txt | 8 +- doc/rewrite.txt | 20 +- doc/rrdtool.txt | 2 +- doc/scgi.txt | 6 +- doc/secdownload.txt | 12 +- doc/security.txt | 4 +- doc/setenv.txt | 4 +- doc/simple-vhost.txt | 18 +- doc/skeleton.txt | 4 +- doc/spawn-php.sh | 2 +- doc/ssi.txt | 6 +- doc/state.txt | 42 +- doc/status.txt | 12 +- doc/userdir.txt | 10 +- doc/webdav.txt | 12 +- lighttpd.spec | 6 +- lighttpd.spec.in | 4 +- openwrt/Makefile.in | 2 +- openwrt/control | 4 +- openwrt/lighttpd.conf | 36 +- openwrt/lighttpd.mk | 12 +- openwrt/lighttpd.mk.in | 10 +- src/Makefile.am | 42 +- src/Makefile.in | 37 +- src/array.c | 108 +- src/array.h | 48 +- src/base.h | 224 ++-- src/buffer.c | 230 ++--- src/buffer.h | 10 +- src/chunk.c | 128 +-- src/chunk.h | 14 +- src/configfile-glue.c | 130 +-- src/configfile.c | 408 ++++---- src/configparser.c | 68 +- src/configparser.y | 34 +- src/connections-glue.c | 8 +- src/connections.c | 641 ++++++------ src/data_array.c | 16 +- src/data_config.c | 24 +- src/data_count.c | 24 +- src/data_fastcgi.c | 20 +- src/data_integer.c | 18 +- src/data_string.c | 30 +- src/etag.c | 8 +- src/etag.h | 2 +- src/fastcgi.h | 4 +- src/fdevent.c | 64 +- src/fdevent.h | 48 +- src/fdevent_freebsd_kqueue.c | 14 +- src/fdevent_linux_rtsig.c | 80 +- src/fdevent_linux_sysepoll.c | 56 +- src/fdevent_poll.c | 52 +- src/fdevent_select.c | 28 +- src/fdevent_solaris_devpoll.c | 50 +- src/http-header-glue.c | 108 +- src/http_auth.c | 648 +++++++----- src/http_auth.h | 22 +- src/http_auth_digest.h | 2 +- src/http_chunk.c | 58 +- src/inet_ntop_cache.c | 18 +- src/joblist.c | 22 +- src/keyvalue.c | 110 +- src/keyvalue.h | 32 +- src/lemon.c | 38 +- src/lempar.c | 34 +- src/log.c | 70 +- src/log.h | 2 +- src/mod_access.c | 74 +- src/mod_accesslog.c | 318 +++--- src/mod_alias.c | 84 +- src/mod_auth.c | 248 ++--- src/mod_cgi.c | 528 +++++----- src/mod_cml.c | 113 +-- src/mod_cml.h | 14 +- src/mod_cml_funcs.c | 126 +-- src/mod_cml_lua.c | 174 ++-- src/mod_compress.c | 302 +++--- src/mod_dirlisting.c | 122 +-- src/mod_evasive.c | 64 +- src/mod_evhost.c | 128 +-- src/mod_expire.c | 176 ++-- src/mod_fastcgi.c | 1488 +++++++++++++-------------- src/mod_flv_streaming.c | 94 +- src/mod_indexfile.c | 100 +- src/mod_magnet.c | 245 +++-- src/mod_magnet_cache.c | 6 +- src/mod_mysql_vhost.c | 114 +-- src/mod_proxy.c | 522 +++++----- src/mod_redirect.c | 138 +-- src/mod_rewrite.c | 208 ++-- src/mod_rrdtool.c | 212 ++-- src/mod_scgi.c | 1476 +++++++++++++-------------- src/mod_secure_download.c | 138 +-- src/mod_setenv.c | 98 +- src/mod_simple_vhost.c | 110 +- src/mod_skeleton.c | 94 +- src/mod_ssi.c | 458 ++++----- src/mod_ssi.h | 18 +- src/mod_ssi_expr.c | 166 +-- src/mod_ssi_expr.h | 6 +- src/mod_ssi_exprparser.c | 60 +- src/mod_ssi_exprparser.y | 26 +- src/mod_staticfile.c | 220 ++-- src/mod_status.c | 356 +++---- src/mod_trigger_b4_dl.c | 246 ++--- src/mod_userdir.c | 102 +- src/mod_usertrack.c | 126 +-- src/mod_webdav.c | 58 +- src/network.c | 236 ++--- src/network_freebsd_sendfile.c | 76 +- src/network_linux_sendfile.c | 82 +- src/network_openssl.c | 86 +- src/network_solaris_sendfilev.c | 82 +- src/network_write.c | 56 +- src/network_writev.c | 84 +- src/plugin.c | 144 +-- src/plugin.h | 22 +- src/request.c | 388 +++---- src/response.c | 262 ++--- src/server.c | 372 +++---- src/settings.h | 14 +- src/spawn-fcgi.c | 186 ++-- src/splaytree.c | 10 +- src/splaytree.h | 2 +- src/stat_cache.c | 172 ++-- src/status_counter.c | 2 +- src/status_counter.h | 2 +- src/stream.c | 32 +- tests/Makefile.am | 4 +- tests/Makefile.in | 6 +- tests/bug-06.conf | 38 +- tests/bug-12.conf | 38 +- tests/cachable.t | 2 +- tests/condition.conf | 4 +- tests/core-request.t | 2 +- tests/core-response.t | 2 +- tests/core-var-include.t | 4 +- tests/core.t | 2 +- tests/docroot/123/Makefile.am | 2 +- tests/docroot/123/Makefile.in | 4 +- tests/docroot/Makefile.in | 2 +- tests/docroot/www/Makefile.in | 2 +- tests/docroot/www/cgi-pathinfo.pl | 2 +- tests/docroot/www/cgi.php | 2 +- tests/docroot/www/cgi.pl | 2 +- tests/docroot/www/expire/Makefile.in | 2 +- tests/docroot/www/get-env.php | 2 +- tests/docroot/www/get-server-env.php | 2 +- tests/docroot/www/go/Makefile.in | 2 +- tests/docroot/www/go/cgi.php | 2 +- tests/docroot/www/indexfile/Makefile.in | 2 +- tests/docroot/www/indexfile/return-404.php | 6 +- tests/docroot/www/nph-status.pl | 2 +- tests/fastcgi-auth.conf | 42 +- tests/fastcgi-responder.conf | 40 +- tests/fcgi-auth.c | 19 +- tests/fcgi-responder.c | 13 +- tests/lighttpd.conf | 28 +- tests/lowercase.conf | 22 +- tests/lowercase.t | 2 +- tests/mod-access.t | 2 +- tests/mod-auth.t | 12 +- tests/mod-cgi.t | 2 +- tests/mod-compress.t | 2 +- tests/mod-redirect.t | 2 +- tests/mod-rewrite.t | 4 +- tests/mod-setenv.t | 2 +- tests/mod-ssi.t | 2 +- tests/mod-userdir.t | 2 +- tests/prepare.sh | 2 +- tests/request.t | 2 +- tests/run-tests.pl | 4 +- tests/var-include.conf | 2 +- 208 files changed, 10457 insertions(+), 9639 deletions(-) create mode 100644 doc/magnet.txt diff --git a/COPYING b/COPYING index 3f69976..1333e45 100644 --- a/COPYING +++ b/COPYING @@ -17,15 +17,15 @@ modification, are permitted provided that the following conditions are met: be used to endorse or promote products derived from this software without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/ChangeLog b/ChangeLog index 26e6528..642ad53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,14 +24,14 @@ This file is abondend in favour of the NEWS file unified test-scripts to use the same framework -14.06.2005 23:38 +14.06.2005 23:38 - documentation updated docs for mod_proxy and mod_scgi 12.06.2005 12:55 - pre-release - mod_fastcgi - + fixed event handling after delayed connect make retry timeout configurable @@ -85,11 +85,11 @@ This file is abondend in favour of the NEWS file fixed automatic redirects if SSL is used fixed compilation on Solaris [283] - + disable accept-filtering on FreeBSD if ssl is used [320] fixed handling of range-request larger than 2Gb - + fixed comparisions of mime-types to case-insensitive [266] added quotation of ETags [376], [378] @@ -121,7 +121,7 @@ This file is abondend in favour of the NEWS file - fastcgi fixed path-info for prefix-patterns - + fixed path-info for PHP 02.03.2005 14:47 - 1.3.12 @@ -131,8 +131,8 @@ This file is abondend in favour of the NEWS file initd and not to lighttpd. Moving the daemonize before starting the fastcgi procs fixes this. -01.03.2005 23:59 -- irix +01.03.2005 23:59 +- irix fixed minor compile issues with MIPSpro @@ -142,7 +142,7 @@ This file is abondend in favour of the NEWS file handle most duplicate headers as 400, Bug #25 - mod_fastcgi - + added more checks 28.02.2005 18:26 @@ -156,7 +156,7 @@ This file is abondend in favour of the NEWS file really compare timestamps, Bug #34 28.02.2005 11:54 -- buffer +- buffer rewrote int2buffer functions @@ -173,8 +173,8 @@ This file is abondend in favour of the NEWS file - cygwin - moved functions used by plugin and main-program to *-glue.c - + moved functions used by plugin and main-program to *-glue.c + - lemon removed warnings about shadowed variables @@ -190,7 +190,7 @@ This file is abondend in favour of the NEWS file - test cases rewrote to test-framework to use Perl + Test::More - ported more test-cases + ported more test-cases 22.02.2005 01:20 - mod_fastcgi @@ -251,22 +251,22 @@ This file is abondend in favour of the NEWS file compile error on MacOS X due to missing environ (patch by Johan Sörensen) (Bug #2) -- indexfiles +- indexfiles append the detected indexfile only once to uri.path (reported by Thomas Seifert) (Bug #3) - + 06.02.2005 15:16 - 1.3.10 - fastcgi display a error-message if a hostname if specified in fastcgi.server->host we need an IP here - + - debug added debug.log-state-handling - + - spawn-fcgi accept a full commandline for spawning @@ -275,7 +275,7 @@ This file is abondend in favour of the NEWS file - fastcgi fixed openssl handling - + - network_freebsd_sendfilev gracefull handling of connections closed on client-side @@ -294,13 +294,13 @@ This file is abondend in favour of the NEWS file - fastcgi added bin-environment to setup the environment of the spawned process - + added bin-copy-environment to copy only the specified set of options from the old environment - + added handling of cmd-line options to bin-path -- setenv +- setenv fixed crashed in setenv.add-response-header @@ -308,18 +308,18 @@ This file is abondend in favour of the NEWS file - configure fixed docs for --with-mysql - + - fastcgi improved performance of building the header (drop strlen()) -04.02.2005 01:59 +04.02.2005 01:59 - cgi don't send file on error - + check if cgi-handler exists before executing it - + added support for nph-... 02.02.2005 21:18 - pre-release @@ -336,9 +336,9 @@ This file is abondend in favour of the NEWS file - fastcgi delete sockets on shutdown - + - http/1.1 - + adding option to disable http/1.1 01.02.2005 12:03 @@ -352,15 +352,15 @@ This file is abondend in favour of the NEWS file - configure make check for valgrind.h covered by --with-valgrind - + - mod_localizer, mod_maps remove both plugins from the distribution - + - file-not-found handle file not found again - + 30.01.2005 16:44 - HEAD requests @@ -368,9 +368,9 @@ This file is abondend in favour of the NEWS file 30.01.2005 15:16 - 1.3.8 - network-handler - + remove debug output on writev() if the remote side closed the connection - + - directory index handle EACCES correctly @@ -379,7 +379,7 @@ This file is abondend in favour of the NEWS file - mod_alias fixed mod_alias + pathinfo handling - + - mod_accesslog added access-log to syslog patch from allan @@ -387,13 +387,13 @@ This file is abondend in favour of the NEWS file 28.01.2005 17:30 - directory redirect without Host-header - use server-ip instead of client-ip for the Location: + use server-ip instead of client-ip for the Location: - fastcgi + pathinfo if fastcgi-auth redirects to a directory which doesn't exist handle it correctly (bug introduced in 1.3.8) - + - requesting directories clean physical.path if directory is requested and dir-listing is disabled @@ -409,7 +409,7 @@ This file is abondend in favour of the NEWS file - fastcgi send content and headers if authorizer mode is used - + use a new connection if connection is died to fastcgi and we have not used it yet @@ -423,7 +423,7 @@ This file is abondend in favour of the NEWS file fixed write-failed after crash of fastcgi-child -16.01.2005 20:43 +16.01.2005 20:43 - setenv fixed setenv.add-environment @@ -475,10 +475,10 @@ This file is abondend in favour of the NEWS file report an error if ssl.engine is enable but no ssl support compiled in 08.01.2005 12:23 -- mod_status +- mod_status added request time to the output - + (late changelog) added host and filename to the output (fobax) (late changelog) HTMLalized the output (fobax) @@ -493,7 +493,7 @@ This file is abondend in favour of the NEWS file reworked the error-page handling -05.01.2005 13:10 +05.01.2005 13:10 - keep-alive handling made sure that keep-alive is really handled correctly @@ -502,7 +502,7 @@ This file is abondend in favour of the NEWS file - mod_setenv added a module to added request and response headers on the fly - + - error-log send error log to syslog() if no errorlogfile is specified (again) @@ -512,7 +512,7 @@ This file is abondend in favour of the NEWS file cut of body for status 301, 304 and 205 -- buffer +- buffer optimized all _hex functions (Silvan Minghetti) @@ -520,7 +520,7 @@ This file is abondend in favour of the NEWS file - fastcgi if bin-path is not specified, don't die (bug introduced in the last pre-rel) - + - auth if userfile is empty don't auth. @@ -533,18 +533,18 @@ This file is abondend in favour of the NEWS file 02.01.2005 16:10 - conditional config - fixed !~ and != - -- buffer + fixed !~ and != + +- buffer copy empty buffers correctly 31.12.2004 17:45 - ipv6 + pidfile - + don't complain if we can't remove the pidfile (Silvan Minghetti) - - remove ipv6 option from the commandline of lighttpd doesn't support + + remove ipv6 option from the commandline of lighttpd doesn't support ipv6 (Silvan Minghetti) 31.12.2004 15:41 - pre-release @@ -571,7 +571,7 @@ This file is abondend in favour of the NEWS file 28.12.2004 23:26 - traffic shaping - + added traffic shaping per connection 25.12.2004 22:58 @@ -585,15 +585,15 @@ This file is abondend in favour of the NEWS file added check for signal and select (compile fix for netbsd 1.4 and 1.5) 11.12.2004 12:38 - 1.3.7 -- fastcgi + php +- fastcgi + php - retry to connect to another PHP child if one of them dies after + retry to connect to another PHP child if one of them dies after connect - + - cgi + multipart don't transform CONTENT_TYPE to HTTP_CONTENT_TYPE - + - debian more cleanup, updated changelog, added more deps and suggests @@ -601,32 +601,32 @@ This file is abondend in favour of the NEWS file 10.12.2004 22:33 - event handler - - fixed crashes in kqueue + + fixed crashes in kqueue 10.12.2004 13:57 - pre-release -- mod_status +- mod_status fixed wraparound in total requests and total traffic - + - debian updated licence and packaging - + - security call setgroups() to get rid of all groups - + - ssl handle SSL_shutdown() == 0 correctly - + fixed openssl detection in configure - - fixed handling of chunked encoding - + + fixed handling of chunked encoding + - request handling - + handle Connection: keep-alive correctly (case as not ignored) 21.11.2004 02:39 @@ -637,23 +637,23 @@ This file is abondend in favour of the NEWS file 20.11.2004 18:43 - conditional - ported + ported - cgi - secdownload - expire - localizer - - usertrack + - usertrack - status - proxy - + - server-tag Server: ... can now be specified by server.tag = "..." - + - spawn-fcgi fixed typo in usage text - + - ssl fixed detection of libs and headers @@ -666,7 +666,7 @@ This file is abondend in favour of the NEWS file 04.11.2004 23:01 - ssi - added support for ${...} + added support for ${...} 03.11.2004 14:51 - 1.3.6 - fastcgi @@ -681,7 +681,7 @@ This file is abondend in favour of the NEWS file 02.11.2004 15:34 - fastcgi - + handle END-OF-REQUEST correctly if chunk-encoding is not used 02.11.2004 10:53 @@ -694,11 +694,11 @@ This file is abondend in favour of the NEWS file add REMOTE_USER, suppress AUTHORIZATION handle payloads > 4k - + - mod_alias fixed url checking - + - follow-symlink fixed config @@ -736,7 +736,7 @@ This file is abondend in favour of the NEWS file fixed offset calculations - ipv6 - + IPv6 might be disabled at compile-time - rewrite @@ -746,7 +746,7 @@ This file is abondend in favour of the NEWS file - auth forgot to reset the global-config handler - + - symlink add option to disable follow-symlink @@ -768,7 +768,7 @@ This file is abondend in favour of the NEWS file 22.10.2004 17:00 - accesslog - added logging of user-supplied data via %{...}o and + added logging of user-supplied data via %{...}o and X-LIGHTTPD-* header 22.10.2004 14:57 - pre-release @@ -776,18 +776,18 @@ This file is abondend in favour of the NEWS file fixed configure-checks and Makefile.am's to build cleanly with a cross-compiler - + builds cleanly for openwrt -22.10.2004 13:03 +22.10.2004 13:03 - out-of-fd improved the out-of-fd handler - + - cgi, fastcgi - set SERVER_NAME to server.name or the value submitted by Host: - + set SERVER_NAME to server.name or the value submitted by Host: + - error-handler only set old status code if it wasn't set by a handler @@ -796,7 +796,7 @@ This file is abondend in favour of the NEWS file - fastcgi don't crash on out-of-fd condition - + - out-of-fd try handle the out-of-fd condition in a sane way @@ -805,15 +805,15 @@ This file is abondend in favour of the NEWS file - mod_auth seperated auth.backend.*.userfile for plain, htpasswd and htdigest - + added 'digest-auth' against 'plain-backend' - + added auth.debug for debugging 16.10.2004 10:18 - 1.3.3 - mod_simple_vhost, mod_evhost - conditional-ized + conditional-ized - mod_rrdtool @@ -823,7 +823,7 @@ This file is abondend in favour of the NEWS file - accesslogs cycle all access-logs - + - mod_rewrite tell the user to install pcre.h if he wants to use mod_rewrite @@ -836,8 +836,8 @@ This file is abondend in favour of the NEWS file 09.10.2004 16:28 - pre-release - cgi - added support for \n in headers - + added support for \n in headers + - mod_auth added conditional auth @@ -858,11 +858,11 @@ This file is abondend in favour of the NEWS file drop a unused file-cache entry after 10 seconds reuse unused entries - + - request-parser accept IPv6 adresses in Host header - + - tests modified the scripts to work with zsh (check on Linux, Irix and FreeBSD) @@ -876,8 +876,8 @@ This file is abondend in favour of the NEWS file - cgi + cygwin cgi need s SYSTEMROOT environment - - + + 22.09.2004 08:55 - network @@ -894,11 +894,11 @@ This file is abondend in favour of the NEWS file fixed cleanup code (matt) -21.09.2004 20:08 -- rrdtool +21.09.2004 20:08 +- rrdtool rrdtool.db-name is now conditional - + fixed check if write() failed (adam) 17.09.2004 17:50 - 1.3.0 @@ -907,10 +907,10 @@ This file is abondend in favour of the NEWS file added url.rewrite-final = ... 17.09.2004 15:55 -- code cleanup +- code cleanup integrated the fixes from cygwin into the main tree - + - kqueue init kqueue after daemonizing (broken since 12.09.2004 14:02) @@ -939,11 +939,11 @@ This file is abondend in favour of the NEWS file - mod_proxy pass remote-addr as X-Forwarded-For to the real server behind the proxy - + - code cleanup moved all cut'n'paste versions of the inet_ntop cache to inet_ntop_cache.c - + - fcgi don't overwrite the fd in fcgi_establish connection if connect fails. this @@ -956,14 +956,14 @@ This file is abondend in favour of the NEWS file - last-modified - don't complain if the If-Modified-Since contains a valid comment/option + don't complain if the If-Modified-Since contains a valid comment/option like ; length = ... 05.09.2004 09:13 - expires overwrite the Expire if it is set by a previous plugin - + - conditional config conditional config as disabled in 1.2.7 by accident @@ -977,34 +977,34 @@ This file is abondend in favour of the NEWS file fixed hanging process if cgi-crash terminates to fast (before we read its response) - + - extented attributes added xattr support, submitted by Ari 29.08.2004 16:00 -- rrdtool +- rrdtool moved the rrdtool support from mod_status into its own module mod_rrdtool - + rrdtool.binary = "/usr/bin/rrdtool" rrdtool.db-name = "/var/www/lighttpd.rrd" - + 29.08.2004 11:00 - pre-release - timeouts - server.max-keep-alive-requests = 0 replaces - server.use-keep-alive = "disable" - - added + server.max-keep-alive-requests = 0 replaces + server.use-keep-alive = "disable" + + added server.max-keep-alive-idle server.max-read-idle - server.max-write-idle - + server.max-write-idle + - docs added a entry for each config-value into configuration.txt - added simple docs for + added simple docs for rewrite redirect compress @@ -1015,23 +1015,23 @@ This file is abondend in favour of the NEWS file - config options complain if no configfile is specified - + - fastcgi removed stupid allocation bug which might cause a problem in really rare cases 26.08.2004 22:06 - 1.2.6 -- optimize +- optimize - use array_strcasecmp() in favour of strcasecmp() as it is slightly + use array_strcasecmp() in favour of strcasecmp() as it is slightly faster. - + apply the case-insentive conversion also on the last character. (adam) - + sort the checked elements in request.c and filter apply the logic to compare some less fields, if the header is not used. - + improved the config-patch function to use our internal buffer-compare functions instead of strcmp @@ -1039,7 +1039,7 @@ This file is abondend in favour of the NEWS file - cgi added missing cleanup code - + - fastcgi remove double-free @@ -1048,7 +1048,7 @@ This file is abondend in favour of the NEWS file - leaks fixed some leaks in the new config code - + - array_strcasecmp fixed alignment in the improved array_strcasecmp function (adam) @@ -1058,9 +1058,9 @@ This file is abondend in favour of the NEWS file optimized a few useless strlen() away as we either know the length from buffer->used - 1 or by sizeof(str) - 1 if it is constant. - + optimized the 'find the \r\n\r\n' function. - + improved the array_strcasecmp() based on another idea from (ralf) - accesslog @@ -1068,20 +1068,20 @@ This file is abondend in favour of the NEWS file enabled the strftime cache again 15.08.2004 23:41 -- accesslog +- accesslog added apache-like CustomLog handling in accesslog.format - + accesslog.format = "..." 15.08.2004 21:08 - test-cases - remove testdir + remove testdir - configfiles - handle escaping of " in strings properly + handle escaping of " in strings properly 13.08.2004 12:07 - array @@ -1089,14 +1089,14 @@ This file is abondend in favour of the NEWS file improved inner-loop of array_strcasecmp() (ralf) 11.08.2004 14:14 -- fcgi socket +- fcgi socket use SUN_LEN if available - + - keep-alive disable keep-alive on request - + server.use-keep-alive = "disable" 10.08.2004 15:59 - 1.2.5 @@ -1108,10 +1108,10 @@ This file is abondend in favour of the NEWS file mod_access mod_compress mod_accesslog - + are ported -10.08.2004 13:05 +10.08.2004 13:05 - pipelining fixed very stupid pipelining bug @@ -1119,13 +1119,13 @@ This file is abondend in favour of the NEWS file 09.08.2004 22:07 - pre-release - conditional config - first code for conditional config + first code for conditional config 09.08.2004 14:21 - fcgi fixed access to free()'d memory (doesn't create any harm) - + - isdigit, warings signed -> unsigned for 2 more isdigit() calls (adam) @@ -1138,17 +1138,17 @@ This file is abondend in favour of the NEWS file 08.08.2004 12:05 - kqueue - + use EV_SET() instead of setting the ev-struct by hand (adam) - -- fcgi + +- fcgi fixed the EINPROGRESS handling to use getsockopt (er) fixed a leak of server is disabled (er) - + - solaris 10 port-api - added a skeleton for the sol10 port api + added a skeleton for the sol10 port api 06.08.2004 10:18 - mod_ssi @@ -1160,12 +1160,12 @@ This file is abondend in favour of the NEWS file dropped usage of MAX() in buffer.c added prober includes for md5.h if openssl is enabled (brad) - + - memory usage documented the way how lighttpd caches memory blocks reset the buffers after they have been written by the network-layer - + - kqueue modify fd-bitmask only if kevent succeeded (adam) @@ -1180,7 +1180,7 @@ This file is abondend in favour of the NEWS file - Makefile fixed dependencies for parallel build in mod_ssi_expr.c - + - combo patch * Tinker with kqueue(). Add a reset method so that the kqueue file @@ -1188,28 +1188,28 @@ This file is abondend in favour of the NEWS file in that adds and deletes are sent to the notification mechanism im- mediately, which should cut down on phantom events. Use ev->kq_results as a sliding window. - + * Change F_SETFD calls to use the preferred FD_CLOEXEC instead of 1. - + * Remove unnecessary fdevent fcntl handlers. It appears that the only driver that needs one is Linux RT signals. - + * Quiet compiler warning about unused parameter. - + * Set the close-on-exec flag for the /dev/poll and epoll_create() file descriptors. - + * Return failure if /dev/poll could not be opened instead of logging and continuing. - + * Detect EAGAIN after writev() failures. FreeBSD sendfile() doesn't need protection, as the man page says: - + When using a socket marked for non-blocking I/O, sendfile() may send fewer bytes than requested. In this case, the number of bytes success- fully written is returned in *sbytes (if specified), and the error EAGAIN is returned. - + (adam, georg, matt) @@ -1217,7 +1217,7 @@ This file is abondend in favour of the NEWS file - mod_ssi check for pcre before compiling the module - + - fdevents dropped fdevent_fcntl added by the last patch (adam) @@ -1244,19 +1244,19 @@ This file is abondend in favour of the NEWS file fd in one kqueue. The handler maintains a separate bitmask for fd filters (1 == EVFILT_IN, 0 == EVFILT_OUT). (adam) - + - server side includes added native server-side includes based on the docs from apache: http://httpd.apache.org/docs/mod/mod_include.html - + not supported are: - - exec - - nested virtual + - exec + - nested virtual - config.errmsg - echo.encoding -24.07.2004 +24.07.2004 - fdevents added a bitset to figure out if we received a event for an unregistered fd @@ -1270,7 +1270,7 @@ This file is abondend in favour of the NEWS file - configfile parse keys correctly that contain a digit (Geoff Adams) - + - fcgi fixed large post uploads (Geoff Adams) @@ -1281,26 +1281,26 @@ This file is abondend in favour of the NEWS file rewrite uri.path to the index-file instead of keeping it at .../ this fixes index-file handling in FastCGI/CGI docroot is used - -- close-on-exec + +- close-on-exec enable close-on-exec handling to simplify FD handling in CGI code - + - cgi keep error-log-fd open to catch the error handling for execve() - + report error if cgi-exec file doesn't exist - + - proxy pass page-content on error to the user (E.R.) code cleanup (E.R.) - -- ssi + +- ssi first skeleton of a plugin for ServerSideIncludes - + - security limit the headerlength again to 64k max @@ -1321,7 +1321,7 @@ This file is abondend in favour of the NEWS file connect stdin, stdout and stderr to /dev/null instead of just closing it use dup2() instead of dup() - + - accesslog if accesslog.filename starts with a | spawn a process which will get data @@ -1362,7 +1362,7 @@ This file is abondend in favour of the NEWS file - mmap cache fixed mmap-caching in network_write.c and network_writev.c after a direct - hint by E.Rodichev + hint by E.Rodichev - sendfile + linux @@ -1391,7 +1391,7 @@ This file is abondend in favour of the NEWS file response headers behaved the same way but are not grouped anymore. They stay seperated. Actually they are concated by \r\n: which is the same in the end. - + - file uploads the handling of longer post requests is fixed now. @@ -1406,7 +1406,7 @@ This file is abondend in favour of the NEWS file the code cleanup is finished successfully. Now all cases of pipelining are handle the right way. POST pipelining was still not working up to now. - + 22.05.2004 12:55 - code cleanup @@ -1417,9 +1417,9 @@ This file is abondend in favour of the NEWS file - network backends enabled sendfile support again (__FreeBSD__ instead of __freebsd__) - + added a mmap cache as part of the filedescriptor cache - + added AIX specific send_file() support (untested) 20.05.2004 10:40 @@ -1431,8 +1431,8 @@ This file is abondend in favour of the NEWS file - documentation reformated the documentation the doc/ directory - -15.05.2004 14:45 + +15.05.2004 14:45 - localizer fixed build of localizer extension @@ -1441,7 +1441,7 @@ This file is abondend in favour of the NEWS file - POST requests there is no need to die if we spot a simple POST request on a static file - + - pipelining fixed HTTP/1.1 pipelining which caused the problems with opera @@ -1458,18 +1458,18 @@ This file is abondend in favour of the NEWS file 1. the application (.php, ...) controls the access to the files 2. the webserver is handling the transfer (and check the app generated tokens) - - the token is based on + + the token is based on - a secret - a timestamp - the filename this means even if the token is is distributed by the user it will get invalid after a given timeout (default 60 seconds) - + - errorfiles check for errorfiles before using them - + - code cleanup applied cleanup fixes from adam @@ -1477,15 +1477,15 @@ This file is abondend in favour of the NEWS file 14.05.2004 18:47 - fdevent handling - added a more generic callback interface to the fdevent structures which + added a more generic callback interface to the fdevent structures which simplifies the writing of plugins. this might destabilize lighttpd for a while - + - cgi fixed header parsing of the header is sent in chunks and the terminator is sent in a single chunk - + - EINTR fixed some occurences of EINTR which read() @@ -1501,8 +1501,8 @@ This file is abondend in favour of the NEWS file added incomplete support for Expect: 100-continue (RFC 2616 8.2.3) by sending always 417 for every Expect-request (see 14.20) - - we have been blamed for not supporting it: + + we have been blamed for not supporting it: http://lists.w3.org/Archives/Public/ietf-http-wg/2004JanMar/0059.html 29.04.2004 23:07 - 1.1.9 @@ -1512,19 +1512,19 @@ This file is abondend in favour of the NEWS file 29.04.2004 19:37 - network-writev - + Adam: * call munmap() on error in write() - + - docs - + E.R: - * documented 'check-local' - + * documented 'check-local' + - test-env made the shell scripts more portable (checked with zsh, bash and ksh) - + fixed compilation on NetBSD 28.04.2004 22:22 @@ -1538,7 +1538,7 @@ This file is abondend in favour of the NEWS file Alexey Slynko: * handle SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE in SSL_write the - right way. + right way. - FastCGI @@ -1560,24 +1560,24 @@ This file is abondend in favour of the NEWS file - mem-leak fixed mem-leak on broken HTTP-headers - + - FastCGI patches from E.Rodichev: - + 1. CONTENT_LENGTH "If no data are attached, then this metavariable is either NULL or not defined". - + 2. QUERY_STRING If the Script-URI does not include a query component, the QUERY_STRING metavariable MUST be defined as an empty string (""). - + 3. Doubling of REMOTE_ADDR removed. - + patches from adam: * fixed bug in the sizeof() patches from yesterday. - * some more *_long to *_off_t + * some more *_long to *_off_t 24.04.2004 14:34 - FastCGI @@ -1588,7 +1588,7 @@ This file is abondend in favour of the NEWS file - POST fixed POST request handling - + - chunk-encoding the generated HEX strings where broken since the 1.1.8 @@ -1601,82 +1601,82 @@ This file is abondend in favour of the NEWS file * sizeof(int) -> sizeof() * assign fd_set instead of memcpy() * init fd -> connection fd pointers to -1 - + 16.04.2004 08:48 - 1.1.8 - code cleanup - + don't reuse buffer > 64k (see settings.h) - - added server.max-request-size to limit the maximum request-body size + + added server.max-request-size to limit the maximum request-body size (in kBytes) - + don't accept HTTP-request headers larger then 32kBytes (see settings.h) - + minor speed improvements in the request-parser - + More cleanup patches from adam: - + * change pre-ANSI C/valid C++ syntax for function declarations/definitions from using () to (void). Ex: int foo(); --> int foo(void); * use static linkage as much as possible, to limit possible symbol collisions * whack more unneeded variables * try and prevent any errno clobbering by storing the old errno value before - any subsequent system calls, and restoring before function exit. + any subsequent system calls, and restoring before function exit. * change printf syntax for unsigned variables from %d to %u - + 15.04.2004 18:41 - code cleanup handle all int != size_t cases in fcgi.c correctly - + check headerfields to have a value - + handle both EINVAL cases of writev() before the can occur - - limit content-length to SSIZE_MAX + + limit content-length to SSIZE_MAX disallow negative content-length - - the usage of ltostr() has been reduced to the minimum in favour of + + the usage of ltostr() has been reduced to the minimum in favour of buffer_/append|copy)_(long|off_t) - + dropped ultostr() and ultohex() in favour of buffer_* 15.04.2004 16:35 -- portablity +- portablity more patches from adam: - + * remove warnings for unused parameters and variables * remove warnings for mismatched pointer assignments * change "gtime_r" to "gmtime_r" 13.04.2004 20:48 -- test-cases +- test-cases made the 'make check' target self-contained - + In our case we have to call the targets in the following order: - + $ ./configure ... - $ make + $ make $ make install $ make check - + because the path to the plugins is hardcoded in the binary itself - - using - + + using + $ ./configure --prefix=/tmp/lighttpd-1.1.x/ ... - + will help if you don't really want to install before testing. 13.04.2004 00:05 -- portability +- portability adam sent another patchset: - + * Wrap PCRE-specific data member access with an #ifdef * Add const to pointer using return value from dlerror() * Explicitly initialize pointer in the lemon parser to 0, @@ -1688,14 +1688,14 @@ This file is abondend in favour of the NEWS file - fastcgi strip WS after HTTP-response headers coming from the FastCGI process - + added REMOTE_USER to the Server->FastCGI headers removed HTTP_AUTHORIZATION from the Server->FastCGI headers 12.04.2004 10:24 - cgi - if we don't get a partial HTTP-response-header send the content out as soon + if we don't get a partial HTTP-response-header send the content out as soon as the cgi script is finished 12.04.2004 01:23 @@ -1706,7 +1706,7 @@ This file is abondend in favour of the NEWS file 12.04.2004 00:12 - configfile - add some usefull error messages if the tokenizer or the parser fail to + add some usefull error messages if the tokenizer or the parser fail to read the configfile 11.04.2004 22:04 @@ -1717,29 +1717,29 @@ This file is abondend in favour of the NEWS file 11.04.2004 20:28 - 64bit offset size - disable linux-sendfile support for linux 2.4.x for now as it don't - support 64bit transfers - + disable linux-sendfile support for linux 2.4.x for now as it don't + support 64bit transfers + fixed all assignments on the path from the stat() to the Content-Length HTTP-header - head requests set content-length in HEAD requests - + - accesslog write accesslog entry on network error - + write the correct amount of byte written to the accesslog - + 11.04.2004 11:48 - code cleanup moved the config for the cgi-plugin from config.c to the plugin. - + moved some buffers which were only used by a one or two plugin from the server-structure to the plugins - + keeping the plugins independent from the server-core is a 'good thing' 10.04.2004 19:06 @@ -1758,47 +1758,47 @@ This file is abondend in favour of the NEWS file the hand-written configfile parser has been replaced by a LALR(1) one. 'lemon' from the sqlite guys has been used to generate the parser. -- by-host, by-url, by-file, by ... +- by-host, by-url, by-file, by ... $HTTP["url"] =~ "~$" { access.deny = "all" } - + $HTTP["host"] =~ "." { simple-vhost.server-root = "/home/weigon/wwwroot/servers/" simple-vhost.default-host = "grisu.home.kneschke.de" simple-vhost.document-root = "pages" } - + $HTTP["host"] == "incremental.home.kneschke.de" { server.docroot = "/hasdasd" } - + at least the parser can handle it now. Currently there is no real support for this context-based config-option. But the syntax and the parser are done. - + 09.04.2004 10:58 - ssl support enable ssl support again - + - mmap - enabled mmap+write again - + enabled mmap+write again + 08.04.2004 12:34 - stricter http-parser - based on a thread at - + based on a thread at + http://lists.w3.org/Archives/Public/ietf-http-wg/2004JanMar/0050.html - - the HTTP-parser has been adjusted to be more correct when it comes to + + the HTTP-parser has been adjusted to be more correct when it comes to request-header fieldnames - + the whitespace handling around the ':' has been relaxed as requested - + 07.04.2004 17:06 - sigaction @@ -1823,11 +1823,11 @@ This file is abondend in favour of the NEWS file - pidfile fixed the permissions of the pidfile (Matthijs van der Klip) - + - specfile merge the RedHat and SuSE specfile with Matthijs - + - 64bit file-offsets moved the FILE_OFFSET_BITS settings from the config.h the Makefile to enable @@ -1838,7 +1838,7 @@ This file is abondend in favour of the NEWS file added an apache compatible mod_expire which adds Expires: headers to the request - + expire.url = ( "/buggy/" => "access 2 hours" ) 05.04.2004 22:34 @@ -1847,14 +1847,14 @@ This file is abondend in favour of the NEWS file forgot to provide the infrastructure to actually enable the devpoll event handler. the same has been done for the freebsd-kqueue handler (which doesn't work yet) - + fixed the devpoll support while testing it on a real solaris box 05.04.2004 09:49 - debian added debian packaging support written by Vincent Wagelaar - + - solaris Another set of patches for Solaris from Adam @@ -1879,37 +1879,37 @@ This file is abondend in favour of the NEWS file - fdevent added framework for freebsd_kqueue and solaris_devpoll - + the solaris_devpoll one might event work (untested) 03.04.2004 16:41 -- network +- network added framework for filebased chunks - read-write + mmap-write - linux-sendfile - freebsd-sendfile - solaris-sendfilev (untested) - + and memorybased chunks - write - writev - + made TCP_CORK a 'global' flag around the write_chunkqueue-calls - + the writev() support should improve the performance for all non-static - pages. - + pages. + 170 req/s against 158 req/s for the following script if writev() is used instead of write() - + \n"; flush(); } - + ?> 28.03.2004 13:42 @@ -1921,35 +1921,35 @@ This file is abondend in favour of the NEWS file * STD{IN,OUT,ERR}_FILENO preferred instead of {0,1,2} * dieing --> dying * SEGFAULT calls abort directly, instead of derefencing a NULL pointer - + - mod_accesslog modified the accesslog format to be CLF compatible set locale for LC_TIME to C - -26.03.2004 16:13 + +26.03.2004 16:13 - path info enabled the pathinfo code again - + 25.03.2004 13:30 - 1.1.3 -- portability +- portability compiles fine now without any patches on IRIX - + - hostname detection reworked "get the hostname for HTTP/1.0 requests which don't specify a Host: ..." to only query the name in this single case for the server side of the connection - + - errorlog handling stderr is only used until the errorlog is init'ed if no error-log is specified, syslog() is used if cycling error-log fails, syslog() is used - + - accesslog cycling don't fall back to stdout anymore @@ -1967,26 +1967,26 @@ This file is abondend in favour of the NEWS file - configure some protability changes to get the 'inline' working with the MIPS CC - + 21.03.2004 22:00 - mod_rewrite, mod_redirect reading the config for those two plugins was not working - + - fdevents changed the compile time setting for the event handling into a run-time setting. - + server.event-handler = "select" # poll, linux-rtsig, linux-sysepoll - + added sys_epoll() for linux 2.6 - + select - all systems poll - Linux 2.1.23+, all XPG4-UNIX - sigio - linux 2.4.0+ + sigio - linux 2.4.0+ sysepoll - linux 2.5.66+ - + 1000-4k-nok 1000-100k-nok select 1776.99 296.52 poll 678.02 607.28 @@ -2003,20 +2003,20 @@ This file is abondend in favour of the NEWS file as the docroot on external hosts might be different than the webserver docroot it can now be specified in the config: - + fastcgi.server = ( ".php" => - ( "grisu" => - ( + ( "grisu" => + ( "host" => "192.168.2.41", "docroot" => "/home/jan/servers/", "port" => 1026 ) ) ) - + a huge internal cleanup in the config handling made the code more readable. some more warnings and error checking should track most of the config - errors for the fastcgi plugin + errors for the fastcgi plugin 19.03.2004 12:34 - external patches @@ -2026,7 +2026,7 @@ This file is abondend in favour of the NEWS file - fix for a debug message - get the hostname for HTTP/1.0 requests which don't specify a Host: ... - rc-script for RedHat - + - documentation added a documentation section about authentification @@ -2035,22 +2035,22 @@ This file is abondend in favour of the NEWS file 19.03.2004 05:11 - optimizations - implemented special versions of + implemented special versions of - strcasecmp (array_strcasecmp) - isdigit, isalpha, isalnum (light_*) - + added a faster check for a finished header - + after disabling all modules it is still possible to get 20 kreq/s. 15.03.2004 19:45 - 1.1.1 - localizer server - added the localizer-server module to the code - + added the localizer-server module to the code + - chunked-encoding - Apple's Safari or HTTP-Handler doesn't handle chunked-extensions defined by + Apple's Safari or HTTP-Handler doesn't handle chunked-extensions defined by RFC 2616 correctly and doesn't ignore them. Disabled the chunked-extension which were just used for debugging purposes. @@ -2059,28 +2059,28 @@ This file is abondend in favour of the NEWS file moved the checks if a plugins support a given function from the dispatcher (plugins_call) to plugins_call_init() to do the check only once. - + equalized the plugins functions to only two types: SERVER_FUNC() CONNECTION_FUNC() - + replaced all handwritten plugin_call-handlers with macros - + made all plugin-functions 'static' - + with all plugins loaded we are at 15kreq/s gain without any plugin loaded at 16kreq/s - + before the change we were at 13kreq/s -06.03.2004 21:13 +06.03.2004 21:13 - compilation fixes fixed some warnings on FreeBSD and NetBSD by adding - #include - + #include + ifdef'ed a pcre-entry in base.h - + remove #define _XOPEN_SOURCE from http_auth.c for IRIX crypt() on Linux needs _XOPEN_SOURCE @@ -2089,20 +2089,20 @@ This file is abondend in favour of the NEWS file added htpasswd and htdigest backends to work against user-files generated by htpasswd and htdigest. - + for basic auth: - plain - htpasswd (crypt only) - htdigest - + for digest auth: - plain - htdigest - + 06.03.2004 17:35 - authentification - check the method in the authorization header againt the configured method + check the method in the authorization header againt the configured method 06.03.2004 14:54 - hostname parsing @@ -2114,17 +2114,17 @@ This file is abondend in favour of the NEWS file - configuration added a warning for unknown configuration variables. - + dropped the 'specific-for.url' ideas for now as it is not known yet how to implement it the right way - + renamed some config-variables to reflect there actual meaning - server.host -> server.bind - server.virtual-* -> simple-vhost.* - server.userid -> server.username - server.groupid -> server.groupname - server.docroot -> server.document-root - + 05.03.2004 15:36 - fastcgi @@ -2133,26 +2133,26 @@ This file is abondend in favour of the NEWS file plugin itself - vhosting - + got a patch for enhanced virtualhosting from christian kruse -> mod_evhost - + moved the virtual hosting config (server.virtual-*) to it's own module called mod_simple_vhost 23.02.2004 10:06 - configfile - + rearragned the config-file structure again to be able to add settings for - a given URL, Host, Filename, ... + a given URL, Host, Filename, ... This change affects some config-options directly (access.deny, url.rewrite, url.redirect, virtual-hosting, ...) - - added 'specific-for.url' for url specific config settings - + + added 'specific-for.url' for url specific config settings + - digest auth FIX: md5-sess type - + seperate the auth-backend stuff 13.02.2004 22:23 - lighttpd 1.0.3 @@ -2171,47 +2171,47 @@ This file is abondend in favour of the NEWS file FIX: the search for header fields was up to now case-sensitive. Now it is like required by the standard case-in-sensitive. - + - browser bugs - + w3m 0.2.5 adds an additional \r\n at the end of the POST requests which is handled now - + 10.02.2004 10:12 - start script took the suse rc-skeleton which states to be LSB compliant and modified it for lighttpd needs - -09.02.2004 11:48 + +09.02.2004 11:48 - HEAD requests FIX: HEAD requests for static files delived the content from the GET request. (test case is added) -08.02.2004 15:53 +08.02.2004 15:53 - directory listings - - FIX: the pathname has not encoded at all before it was transfered to the + + FIX: the pathname has not encoded at all before it was transfered to the browser. a proper url and html-encoding has been added. - - added modification-time and filesize to the output - + + added modification-time and filesize to the output + added a basic css for the virtual listings 07.02.2004 22:15 - lighttpd 1.0.2 - sample configfile rearranged the config-file to have all the important options at the top - + - docs added a mod-rewrite options - + - mod_accesslog stdout is no longer used a default for the accesslog - + - error-messages the 404 is now reported in the error-log @@ -2220,39 +2220,39 @@ This file is abondend in favour of the NEWS file - configfile handling if a key is used twice like - - url.rewrite = ( "url1" => "url") - url.rewrite = ( "url2" => "url") - + + url.rewrite = ( "url1" => "url") + url.rewrite = ( "url2" => "url") + you get an error now. You have to write: - - url.rewrite = ( "url1" => "url", - "url2" => "url") + + url.rewrite = ( "url1" => "url", + "url2" => "url") 31.01.2004 12:22 - lighttpd 1.0.1 - log cycling added a sighup-handler to the plugin interface and fixed the log-cycling for access-logs - + - portability - + disabled the interval-time optimization on IRIX - documentation - + added a lot of new documentation to README 31.01.2004 10:59 - status module added two new options rrd-dir and rrd-reports: - + rrd-reports = (boolean) # enables RRD-reports rrd-dir = (string) # path for the daily status-files - + fixed the "status-files in /"-bug this way - + 22.01.2004 13:38 - lighttpd 1.0.0 - simple docroot @@ -2269,10 +2269,10 @@ This file is abondend in favour of the NEWS file Verified again that the code compiles and runs cleanly on Linux, FreeBSD, NetBSD and IRIX - + compiling with gcc and the option -pedantic works fine compiling with mipspro cc works fine, too - + - tests added some more tests: 39 tests @@ -2281,11 +2281,11 @@ This file is abondend in favour of the NEWS file - protability some compile fixes for FreeBSD have been applied and a new switch has been - added to choose between IPv4 and IPv6 on FreeBSD. + added to choose between IPv4 and IPv6 on FreeBSD. (cmdline: -6, configfile: server.use-ipv6) - packaging - + cleaned up the specfile for building RPMs 21.12.2003 01:00 @@ -2302,7 +2302,7 @@ This file is abondend in favour of the NEWS file - compression added gzip compression (gzip-header + deflate + crc) - + - test harness framework added a 22 tests to verify the correct behaviour of lighttpd @@ -2310,9 +2310,9 @@ This file is abondend in favour of the NEWS file - request parsing GET http://www.yahoo.com/ HTTP/1.0 - + is handled now as - + GET / HTTP/1.0 - plugins @@ -2325,8 +2325,8 @@ This file is abondend in favour of the NEWS file the directory structure is now build automaticly 15.12.2003 01:00 -- compression - +- compression + added a compression cache to the compression module (mod_compress) Vary: Accept-Encoding is set now as it influences to delivered stream of @@ -2336,19 +2336,19 @@ This file is abondend in favour of the NEWS file - config files a new config-file format is ready for the final release of lighttpd. - + it supports: - + server.docroot = "string" server.host = integer server.modules = ( "string", "string" ) server.mimetypes = ( "key" => "value" ) - server.complex = ( "key" => ( "string", integer ), - "string", + server.complex = ( "key" => ( "string", integer ), + "string", integer ) - + the syntax should look familar to all who worked with Perl or PHP. - + config-file handling has been seperated into a parser and a lexer. Both are currently written by hand and will propably be rewritten into bison + flex if time permits. But that would be a cosmetical change. @@ -2358,11 +2358,11 @@ This file is abondend in favour of the NEWS file improved the status page to display - the current connection-stati - - average throughput over 5 seconds + - average throughput over 5 seconds (requests/s and output-bound traffic) now you can see what is going on in the server - + - access-log the accesslog is now a module and can be disabled by just removing the @@ -2372,36 +2372,36 @@ This file is abondend in favour of the NEWS file - chroot-ing how-to: using chroot - + - chroot to /home/www/ - docroot at /servers//pages/ - defaulthost www.example.org - + e.g. (external view) /home/www/servers/www.example.org/pages/index.html - + (in chroot) /servers/www.example.org/pages/index.html - + config: - + chroot /home/www/ userid wwwrun groupid nogroup - + virtual-server-root /servers/ virtual-server-default-host www.example.org virtual-server-docroot /pages/ - - The FastCGI process is living outside this chroot definition as it is + + The FastCGI process is living outside this chroot definition as it is started seperatly. - + 01.12.2003 02:06 - cleanup in preparation for the first stable release some internals had to be - cleaned up. Basicly it was a cleanup of workflow of the creation of the - response-header. All modules can use a clean interface for this purpose + cleaned up. Basicly it was a cleanup of workflow of the creation of the + response-header. All modules can use a clean interface for this purpose now. This is espacially usefull for all modules which have to pass some HTTP-headers to the client. @@ -2410,9 +2410,9 @@ This file is abondend in favour of the NEWS file finally moved the modules to shared libraries and cleaned up some code path to become more readable. - + So far we have: - + mod_rewrite mod_redirect mod_access @@ -2426,23 +2426,23 @@ This file is abondend in favour of the NEWS file - redirects as lighttpd supports url-rewriting redirection was a few lines of new code. - + redirect ^/wishlist/(.+) http://jan.kneschke.de/wishlist/$1 - + rewrite ^/wishlist/(.+) /new/wishlist/$1 28.11.2003 17:00 -- signal stuff +- signal stuff setitimer is used to send a event every second to call time() only once a second. another system call which has been remove from the main-loop. - + sending HUP to lighttpd will close and re-open the logfiles. this is used for cycling logfiles. - + #! /bin/sh -### +### # # a simple logfile rotator for lighttpd # @@ -2459,7 +2459,7 @@ gzip access.log.${DATE} a first attempt for a native win32 has been done. For now mingw is the base for the development as it provides a basic unix-like framework for building native win32 applications. - + the most internal files have been ported and the over all progress is going well. At the end this will just be a prove of concept. @@ -2467,7 +2467,7 @@ gzip access.log.${DATE} - access denied added a access-deny filter to block specific urls like - + access-deny ~ access-deny .inc @@ -2476,15 +2476,15 @@ gzip access.log.${DATE} a fstat() on a opened fd which has changed reports wrong the file-info. Using stat() again helps to solve this problem. - + the sig-io version doesn't suffer from this problem. - + the etags are now used for verifing file-cache-entries. - + - chat - + enabled the internal login mechanism again - + added support transfering session-infos over MySQL. 15.11.2003 00:19 @@ -2493,24 +2493,24 @@ gzip access.log.${DATE} added a buffer_equal_reverse function which is optimized version of strcmp which is going backwards as pathnames are often the same for in the first bytes. - + wrote a one-pass parser for the request-header. The combination of strstr(..., "\r\n") to seperate lines and strchr(..., ':') to seperate keys from values more or less touched every byte twice. - + we are still at 18.000 req/s for 4kb keep-alive requests even with etags and handling all header fields. 14.11.2003 17:26 - fcgi - + Content-Type wasn't passed correctly to the FastCGI app. HTTP_CONTENT_TYPE was sent instead. - + - cache - + provided access to the Session-ID - + - error-log the timestamp is now written in a human readable form @@ -2519,142 +2519,142 @@ gzip access.log.${DATE} - fcgi, cgi added a special set of array-functions which are optimised for the "insert - only once" case. - + only once" case. + this provides access to the headers which are now forwarded to the external interfaces. Before this change only a limited set of request-headers were forwarded. - + 21.10.2003 11:58 -- modules +- modules added a new module-hook after the basic-init of the module for handling config-settings and prepare the overall operartion (like building db-connections, compiling regexes, ...) - + - cache use turckmm-cache 2.4.3 to get some numbers for the php-latency: - + /usr/sbin/ab -n 10000 -c 10 http://alba.home.kneschke.de:1025/index.php - + handling the cache-decision and the cache-hit in php: - + cache-miss: 100% (-> $version = 0) - + plain : 108.13 req/s turckmm-cache: 218.39 req/s - + cache-hit: 100% (-> $version = 1) - + plain : 164.45 req/s turckmm-cache: 653.98 req/s - + handling the cache-decision and the cache-hit in the server: - + cache-hit: 100%, but using index.cml - + cml: 4918.84 req/s (no keep-alive) cml: 6901.31 req/s (keep-alive) - + cache-miss: 100%, but using index.cml - + plain : 108.39 req/s turckmm-cache: 217.84 req/s - + Conclusion: - there is no loss in the cache-miss case through the cml-handling - the cache-hit case can be improved dramaticly with lighttpd-cache - turckmm-cache improves the cache-miss case alot - + 20.10.2003 00:40 - cache the first 'real-life' test showed dramatic improvements in the req/s handling. - + The basic idea was to move the decision if a php-page can be taken from - the cache from the php-code to the webserver. - + the cache from the php-code to the webserver. + See here why this is a good thing: - + the quite common code which works for http://jan.kneschke.de/ is using templates and is quite static, but depends on 4 external files (the menu-structure, the template, the current content, the class-file). - + the index-file is always: - + include_once "jk.inc"; - + $v = new view(); print $v->get(array(array ("file" => "content.html"))); - + It is more or less the same for all pages. - - This basic setup can deliver 100 requests/s. - - The next step has: + + This basic setup can deliver 100 requests/s. + + The next step has: - application bases caching - + as we know that each pages depends on those 4 files, you can check if they have been modified since the last request and deliver the content from the cache otherwise. - + this increased the throughput to 150 req/s. (cache-hit ratio 100%) - + The next logic step is to move the decision-making process out of the PHP code as PHP is to slow for the cache-hit path: - + a CML (Cache-Markup-Language) has been written which describes the whole decision process which has been written in PHP-code before: - - + + output.content-type text/html - + output.include _cache.html - + trigger.handler index.php - + trigger.if file.mtime("../lib/php/menu.csv") > file.mtime("_cache.html") trigger.if file.mtime("templates/jk.tmpl") > file.mtime("_cache.html") trigger.if file.mtime("content.html") > file.mtime("_cache.html") if one of the 'trigger.if' statements is true the 'trigger.handler' is called to generate the pages. - + if none of the them is trigger the files from 'output.include' are sent to the browser with content-type specified in the first line: - - The result was very 'promissing': - + + The result was very 'promissing': + 5900 req/s with keep-alive 3800 req/s without keep-alive (both for a cache-hit ratio of 100%) - + for keep-alive this is factor 59 against the plain un-cached version and still 39 againt the php-cache-version which is doing exactly the same. - + Time for party. :) - + 19.10.2003 - 18:55 - cache the handling of functions has been improved. they are now 'plugable'. just the dlopen() stuff is missing. - + a new datatype has been added: the string - + this makes it possible to evaluate something like: - + trigger.if unix.time.now() - file.mtime("head.html") > 30 trigger.if mysql.query("SELECT count(*) " + \ " FROM structure AS struc, session AS sess " + \ " WHERE struct.user = sess.user" + \ " AND sess.id = \"" + mysql.escape("ab\"c") + "\"") - - you see: + + you see: - string operations (concat) - handing of escape-sequences - functions @@ -2667,19 +2667,19 @@ trigger.if mysql.query("SELECT count(*) " + \ handler a lot easier. The CVS server was up all the time but not used. Importing required 5 minutes of work which included merge the freebsd and the linux tree. - + - compilers + platforms on a regular various compilers and platform are check to compile with with the current code base: - + platform | os | compiler | state ---------+---------------------+--------------+--------- ia32 | Linux 2.4.22 | gcc 2.95.3 | ok ia32 | FreeBSD 5.1-CURRENT | gcc 3.3.1 | ok mips64 | IRIX 6.5 | gcc 3.2.2 | ok misp64 | IRIX 6.5 | MIPSpro 7.41 | ok - + the mipspro compiler revealed some warning which resulted in a nice code-cleanup that made the code more readable. @@ -2687,23 +2687,23 @@ trigger.if mysql.query("SELECT count(*) " + \ - e-tags and friends in preparation for the php-conference at the begin of november in - frankfurt/main the server has the support some more caching/proxy tags - like: + frankfurt/main the server has the support some more caching/proxy tags + like: - E-Tag (14.19) [done] - If-Match (14.24) - If-None-Match (14.26) [done] - - If-Range (14.27) - + - If-Range (14.27) + Section (13.3.3) binds them together. [RFC 2616] - + using lxr.kde.org and lxr.mozilla.org revealed that - konqui only uses if-none-match - mozilla uses if-none-match and if-range - + it looks like it isn't that easy to trigger the if-range case. - - As ulf suggested the etag is a hash of file-size, inode-number and mtime. - + + As ulf suggested the etag is a hash of file-size, inode-number and mtime. + - fd-caching ulf just phoned me ask proposed the free the cache more agressivly in case @@ -2711,26 +2711,26 @@ trigger.if mysql.query("SELECT count(*) " + \ 17.10.2003 12:45 - chat - + finished the mysql-support for storing the sessions 12.10.2003 20:56 - valgrind used valgrind again to verify that the code a free of mem-leaks and found - a 'leak generator' in the chunk-api. - + a 'leak generator' in the chunk-api. + the last few leaks were just some missing free()'s at the end of the program run which would have been freed anyway. - + at the end valgrind couldn't find any missing free()'s. 11.10.2003 12:09 - FastCGI - reduced the number of system calls for FastCGI to WebServer to 2 calls per + reduced the number of system calls for FastCGI to WebServer to 2 calls per fd-event. (ioctl() + read()) - + this has no direct effect of the performance of the server, but improves the possible througput of the load-balancer. @@ -2739,8 +2739,8 @@ trigger.if mysql.query("SELECT count(*) " + \ a brown paper bug has been fixed which caused to decreasing throughput if load-balancing was enabled. - - + + benchmarking the req/s with load-balancing shows really nice results: @@ -2748,20 +2748,20 @@ trigger.if mysql.query("SELECT count(*) " + \ ---------+-------------------------------------------------- ulf : 764.06 (php) lappi : 800.06 (php) - + ulf+lappi: 1526.95 (2 * php) - - grisu : 1265.66 (php + ab + lighttpd) - - + + grisu : 1265.66 (php + ab + lighttpd) + + all : 1647.72 (3 * php + ab + lighttpd) - all(nice): 1904.40 (same as all, but the local php on grisu + all(nice): 1904.40 (same as all, but the local php on grisu has been 'nice -20'd) - - + + if a php is run on the load-balancer it has to get a lower priority than the load-balancer itself as to handle the work of (here) 3 php-servers. - + 10.10.2003 15:11 - java ? @@ -2773,108 +2773,108 @@ trigger.if mysql.query("SELECT count(*) " + \ Last week 3 RTL8169S gigE cards arrived and were installed in the test-framework. - + They are very cheap (20 Euros) and are a good start for a low-level - benchmark network. - + benchmark network. + First result show us: - + 48 Mb/s with ab. - + The webserver and the test-server are equipped with a 2000+ AMD CPU. The system load 95%, user load is 3%, the rest is idle on both plattforms. After some calculations at gets clear that there are various bottlenecks: - - 1. The PCI-Bus (32bit/33Mhz) can only transfer 133Mb/s + + 1. The PCI-Bus (32bit/33Mhz) can only transfer 133Mb/s - 48 Mb/s TCP-Traffic results in 55Mb/s Ethernet-Traffic (verified with slurm) [outgoing] - there is about 10Mb/s incomming traffic at the PCI bus which the requests - - the rest of the devices at the PCI bus are eating the last few mb/s + - the rest of the devices at the PCI bus are eating the last few mb/s 2. IRQ-Handling - There are reasons why the RTL8169S cards are so cheap - they can't send jumbo-frames - - only 8k/64k buffers which results in a interrupt every 3 packets + - only 8k/64k buffers which results in a interrupt every 3 packets - they are at least handling checksum offloading for ip, udp and tcp - + In the end there is a need for new hardware to limit the throughput by the Ethernet again. - PCI-X, 64bit-PCI, ... - 'real' gigE-Network cards - ... - - + + BTW: 2.4.22 + the r8139 driver are very flacky and resulted in 3 lock-ups - for today. - + for today. + In another test the dual-PPro-FreeBSD 5.1-CURRENT machine has been used as server with a gigE interface (re0) at has shown that the CPU is the limit for this combination. The maximum thoughput was 7Mb/s. - - Another small benchmark: + + Another small benchmark: $ ab -n 1000 -c 10 http://192.168.2.41:<port>/lighttpd-20030925.tar - - port | server | CPU Idle + + port | server | CPU Idle ------+-------­---------+----------- 1025 | lighttpd | 75% 1026 | thttpd 2.23b1 | 75% 1027 | boa-0.94.14rc17 | 69% * 1028 | apache 1.3.x | 77% - - + + In all 4 cases the thoughput was 8600 kbytes/s. - + * boa had 9 failed transfers. - -- FreeBSD - + +- FreeBSD + The problems with FreeBSD 5.0-RELEASE vanished after updating to 5.1-CURRENT. 26.09.2003 18:22 - FreeBSD - + A SMP-machine has been added to the test-farm. It is running FreeBSD 5.1-RELEASE and will help to the improve the scalability. fixed sendfile() handling. - + - FreeBSD problems FreeBSD-5.1-RELEASE-SMP 2 * Pentium Pro 200 MHz 192.168.2.38 (doubleheart) (webserver [lighttpd at port 1025, thttpd at port 1027]) - + Linux 2.4.20 1 * AMD 2000+ 192.168.2.10 (grisu) (ab) - + Problem: Connections are reset by the kernel without any application intervention. - + Calling 'ab' (apachebench) at grisu with the following paramters: - + /usr/sbin/ab -n 10000 -c 10 http://192.168.2.38:1025/index.html - + results in the following output: - + ... Time taken for tests: 40.610 seconds Complete requests: 10000 Failed requests: 5980 (Connect: 0, Length: 5980, Exceptions: 0) ... - - - This is reproducable and the number of failed requests is always + + + This is reproducable and the number of failed requests is always 5980 +/- 50 requests. In other words: after 4000 requests tcpdump shows the following output: tcpdump shows: - + 00:53:48.923029 192.168.2.10.39774 > 192.168.2.38.1025: S [tcp sum ok] 1013737315:1013737315(0) win 5840 <mss 1460,sackOK,timestamp 5208461 0,nop,wscale0> (DF) (ttl 64, id 7918, len 60) @@ -2892,7 +2892,7 @@ trigger.if mysql.query("SELECT count(*) " + \ 0x0030 0101 080a 0044 0d12 004f 798d .....D...Oy. 00:53:48.924009 192.168.2.10.39774 > 192.168.2.38.1025: . [tcp sum ok] ack 1 - win 5840 <nop,nop,timestamp 5208461 4459794> (DF) + win 5840 <nop,nop,timestamp 5208461 4459794> (DF) (ttl 64, id 7919, len 52) 0x0000 4500 0034 1eef 4000 4006 9654 c0a8 020a E..4..@.@..T.... 0x0010 c0a8 0226 9b5e 0401 3c6c 6764 6b84 bac1 ...&.^..<lgdk... @@ -2900,7 +2900,7 @@ trigger.if mysql.query("SELECT count(*) " + \ 0x0030 0044 0d12 00:53:48.924150 192.168.2.10.39774 > 192.168.2.38.1025: P [tcp sum ok] - 1:29(28) ack 1 win 5840 <nop,nop,timestamp 5208461 4459794> (DF) + 1:29(28) ack 1 win 5840 <nop,nop,timestamp 5208461 4459794> (DF) (ttl 64, id 7920, len 80) 0x0000 4500 0050 1ef0 4000 4006 9637 c0a8 020a E..P..@.@..7.... 0x0010 c0a8 0226 9b5e 0401 3c6c 6764 6b84 bac1 ...&.^..<lgdk... @@ -2918,9 +2918,9 @@ trigger.if mysql.query("SELECT count(*) " + \ strace shows that no connection attempt has been reported to the application which is poll()'ing the server socket. - + /* the common loop without any block attempts */ - + accept(3, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, [0]) = 5 fcntl(5, F_SETFL, O_RDWR|O_NONBLOCK) = 0 read(5, "GET /index.html HTTP/1.0\r\n\r\n", 4095) = 28 @@ -2930,13 +2930,13 @@ trigger.if mysql.query("SELECT count(*) " + \ write(2, "1064875136: (network.c.210) 235 "..., 33) = 33 syscall_393(0x6, 0x5, 0, 0, 0x10fc, 0, 0xbfbff2c0, 0) = 0 close(5) = 0 - + /* no futher waiting connections */ - + accept(3, 0xbfbff700, [1852702730]) = -1 EAGAIN (Resource temporarily unavailable) - + /* enter the main-loop */ - + gettimeofday({1769235301, 1663069807}, NULL) = 0 poll([{fd=3, events=POLLIN}], 1, 1000) = 0 gettimeofday({4294967295, 65537}, NULL) = 0 @@ -2944,9 +2944,9 @@ trigger.if mysql.query("SELECT count(*) " + \ gettimeofday({4294967295, 65537}, NULL) = 0 poll([{fd=3, events=POLLIN}], 1, 1000) = 0 ... - + (strace is broken for accept() and gettimeofday(), syscall_393() is sendfile()) - + after entering the main-loop the webserver doesn't receive any new POLLIN events at all for the next 10-15 seconds. Any connection-attempt within the period is, as you can see in the tcpdump output, accepted by the @@ -2954,23 +2954,23 @@ trigger.if mysql.query("SELECT count(*) " + \ After those 10-15 seconds the application gets a POLLIN event for the server socket and the normal data-transfer taken place for the next 4000 requests. - + This behaviour is reproducable with thttpd 2.20c and the current lighttpd. - + 26.09.2003 11:42 - localizer - ported the localizer-server application into a module for lighttpd. After - 30 minutes the code was ported and funtional. This modules provides access - to the localizer-db by a HTTP-Interface and generates the response as + ported the localizer-server application into a module for lighttpd. After + 30 minutes the code was ported and funtional. This modules provides access + to the localizer-db by a HTTP-Interface and generates the response as HTML, CSV and plain-text. - + So far, the module-interface looks good and flexible enough. - + 7000 req/s is good enough too. Generating the HTML and querying the DB needs some time. - + 22.09.2003 08:40 - modules @@ -2979,36 +2979,36 @@ trigger.if mysql.query("SELECT count(*) " + \ auth-sub-system and the cache out of the main-code. The module-interface will be extended to allow the cgi and the fastcgi sub-processes to be moved into a module. - + 15.09.2003 09:36 - error-handling fastcgi and cgi connections are now closed correctly if the corresponding client-connection has died. - + 14.09.2003 10:40 - cgi finally streaming works with CGI, too - + this enable support for cgiirc.sf.net and friends which use streaming as there transport mechanism. - + streaming has been verified with cgiirc-0.5.2. - + - fdevents there where some reports that sigio didn't work as expected. It just - reported no events at all. Looks like a known bug in the glibc on + reported no events at all. Looks like a known bug in the glibc on those platforms. - + Using poll() instead solve the problems. 27.08.2003 22:12 - rewrite a pcre based rewrite engine has been integrated - + - cgi the file-based cgi interface has been replace by two pipes. @@ -3016,13 +3016,13 @@ trigger.if mysql.query("SELECT count(*) " + \ 23.07.2003 13:29 - fdevents - the whole fd-event handling has been reworked and several smaller bugs + the whole fd-event handling has been reworked and several smaller bugs and design-errors have fixed. - + sigio, poll() and select() are working fine again. - + On IRIX 6.5 SIGIO could be used, but without further testing poll() is used. - + - cgi CGI-support is still broken. @@ -3031,16 +3031,16 @@ trigger.if mysql.query("SELECT count(*) " + \ using the F_NOTIFY feautre of the Linux 2.4.x kernel gives anothre nice performance boost as lighttpd can cache the stat()'s the right way, now. - + 23009.66 @ 5-4k-k which means +10% against 30.06.2003 14:03 - + for 1000-4k-nok the performace nearly doubles: 3730.23 goes up to 6144.39 17.07.2003 13:21 - FreeBSD a small patch (#include <>) to compile lighttpd on FreeBSD again. - + 08.07.2003 10:48 - fileinfo-cache @@ -3052,35 +3052,35 @@ trigger.if mysql.query("SELECT count(*) " + \ After some problems with other benchmarking tools for webservers the first version of lighttpd-bench has been written. - + It a revealed a nasty strange behaviour which was fixed by increasing the listen-backlog from 5 to 1024. - + 30.06.2003 14:03 - fileinfo-cache the fileinfo-cache has been relaxed a little bit and there are always 2 fstat()'s per file-request now. This isn't that dramatic: - + 21800.74 req/s is still a very good result (7-4k-k). - + 29.06.2003 03:29 - fileinfo-cache a fileinfo cache has been added to reduce the number of system-calls to - stat and open a file. - + stat and open a file. + in the releases before the same file was stat'ed at least 2 times plus a stat on the docroot for each request. Now the stat()'s and the corresponding open() + close() calls are cached and the number of system calls has been reduced to the minimum: - + $ strace -eopen,stat64,read,write,sendfile,accept,shutdown,close \ -p `pidof lighttpd` /* first connection */ -accept(3, {sin_family=AF_INET6, sin6_port=htons(56211), - inet_pton(AF_INET6, "::ffff:192.168.2.10", &sin6_addr), sin6_flowinfo=0, +accept(3, {sin_family=AF_INET6, sin6_port=htons(56211), + inet_pton(AF_INET6, "::ffff:192.168.2.10", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28]) = 5 accept(3, 0xbffff470, [28]) = -1 EAGAIN read(5, "GET /index.html HTTP/1.0\r\nUser-A"..., 4095) = 91 @@ -3108,20 +3108,20 @@ close(5) = 0 In the end we have a new speed record: - + (ab -c 8 -n 100000 http://192.168.2.10:1025/index.html with poll()) Requests per second: 23435.67 [#/sec] (mean) - + This is a speed increasement of 20-30% against the last internal benchmark. 28.06.2003 02:30 -- caching framework +- caching framework the trigger.if directive is working fine. the basic algebra is done ( +, -, *, / and comperations =, <=, >=, >, < and the boolean logic && and || including braces) - + two basic function are available: - unix.time.now - file.mtime(...) @@ -3130,37 +3130,37 @@ close(5) = 0 - caching framework added output.include, output.content-type for a cache-hit and - trigger.handler for a cache-miss. - + trigger.handler for a cache-miss. + the actual decision is made be trigger.if which will be added tomorrow. 15.06.2003 15:33 -- sig-io +- sig-io After several other smaller optimisations lighttpd performs better with sig-io under high load: - + sigio+poll poll c1000-4k-nok : 2635.95 1643.39 c1000-4k-k : 7335.68 6788.87 c1000-100k-nok: 2353.49 1217.73 c1000-100k-k : 3097.89 2080.73 - - + + The user-space part has been optimized a lot. Now it is time to optimized the number of context-switches between user and kernel-mode. - + user 0m0.180s sys 0m1.160s - + a fileinfo-cache is the way to go. - + struct { buffer *name; struct stat st; int handler; ... - + int fd; void *mmap_p; } @@ -3169,42 +3169,42 @@ close(5) = 0 - sig-io is back again and it works fine. - + sigio (Realtime-Signals under Linux 2.4.x) sends one signal per event and buffers the rest of the events in a kernel queue. If the is full a SIGIO is sent and poll() gets all events at once for further processing. - - + + Currently the behaviour is a little bit strange: - sig-io + poll() is good for non-keep-alive connections - poll() for keep-alive connections - + c1000-4k-nok: (1000 concurrent request, 4k filesize, no keepalive) poll : 1521.38 sigio+poll: 2124.00 - + c1000-4k-k: (1000 concurrent request, 4k filesize, keepalive) poll : 5882.35 sigio+poll: 1239.46 - - Very strange for now. - + + Very strange for now. + 09.06.2003 23:59 - code-cleanup - + the event-handling code has been rewritten to handle single events better as they are expected from sig-io. - + the fallback-mode of sig-io is broken now, but the normal poll() mode got - a 10% increasement in speed. This means the we are back the speed level of - 20030308-0155 are as fast as zeus again. - + a 10% increasement in speed. This means the we are back the speed level of + 20030308-0155 are as fast as zeus again. + Especially under higher load the current lighttpd performes better. - + 09.06.2003 11:51 - sig-io benchmark - 20030609-1151 20030608-2110 20030308-0155 + 20030609-1151 20030608-2110 20030308-0155 -c 10 sigio select() poll() poll() 4k : 7870.92 7937.77 8035.36 9443.76 4k (keep-alive) : 14098.41 14590.02 14275.52 17985.61 @@ -3217,15 +3217,15 @@ close(5) = 0 100k (keep-alive) : 4267.67 4283.94 4094.17 4314.06 -For -c 100 4k and 100k sig-io gives a small increasment. +For -c 100 4k and 100k sig-io gives a small increasment. -09.06.2003 01:00 +09.06.2003 01:00 - sig-io writing large files works now as expected. After removing the limit for the chunks of sendfile the write-buffer-is-empty-again signal is generated. that was missing. - + 321 of 10000 connections still have the wrong length. After that is fixed it is time to start some benchmarks again. @@ -3233,11 +3233,11 @@ For -c 100 4k and 100k sig-io gives a small increasment. - sig-io first attempts in getting SIGIO support running which were not very - successfull yet. - + successfull yet. + - poll()/select() benchmark - 20030608-2110 20030525-1623 20030308-0155 + 20030608-2110 20030525-1623 20030308-0155 -c 10 select() poll() poll() poll() 4k : 7937.77 8035.36 8166.60 9443.76 4k (keep-alive) : 14590.02 14275.52 14781.97 17985.61 @@ -3252,7 +3252,7 @@ For -c 100 4k and 100k sig-io gives a small increasment. as the overall processing cycle has been rearranged the overall figures changed in minor ranges. c100-4k-k increased, *-100k-k decreased. - + At least it still works. 08.06.2003 12:45 @@ -3260,7 +3260,7 @@ For -c 100 4k and 100k sig-io gives a small increasment. implementate an abstration layer for fd-events (like eevry other webserver). currently we support poll() and select(). - + This should bring us support for Mac OS X and propably Windows. 04.06.2003 18:35 @@ -3275,10 +3275,10 @@ For -c 100 4k and 100k sig-io gives a small increasment. 04.06.2003 14:34 - pipelining - + adding support for pipeling introduces a problem if the request-header was broken. this has been fixed now. - + - unneccesary slashes when building pathes from different portions of a string (e.g. docroot + @@ -3291,24 +3291,24 @@ For -c 100 4k and 100k sig-io gives a small increasment. the error-log contains the start and end-times of the lighttpd process, now. - + - configfile the config-file parser has been relaxed to accepts tabs instead of spaces. - + - better error-handling - fixed a bug in the FastCGI-SAPI of PHP - + if the fastcgi process dies or closes the connection unexpectedly we return 500 now instead of closing the connection to the client. - + - Location the CGI/1.1-rev-03 specification requires us to send Status 302 if a Location-header is sent by the client and a Status-header is missing. - + - PATH_TRANSLATED if PHP is compiled without --discard-path PATH_TRANSLATED has to be @@ -3318,7 +3318,7 @@ For -c 100 4k and 100k sig-io gives a small increasment. - directory listings if a directory is requested and the directory doesn't contain a index-file - a directory-listing can be displayed. You have to enable directory-listings + a directory-listing can be displayed. You have to enable directory-listings in the config-file (directory-listings on) - url-decoding @@ -3330,35 +3330,35 @@ For -c 100 4k and 100k sig-io gives a small increasment. - pipelining as Sascha required pipelining for his benchmarking tool it has been - implemented. - + implemented. + pipelining allows sending a bunch of requests at once without waiting for the actual responses. This reduces the network-overhead and the round-trip-time. - + - non-free()d memory - + dmalloc helped to close some non-free()d memory. For the normal operation this isn't important as only memory chunks which had to be free()d at the end of the live-time of the lighttpd-process were not de-allocated. - + - partly-initialized variables lighttpd wasn't initializing the main-structure which resulted in strange behaviour in rare circumstances. - + 25.05.2003 16:23 - benchmarks after removing some useless internal copies we are more or less at the old speed levels. - + after adding virtual-hosts 10% of the performance were lost. Using less memcpy() operations might add several other boosts. - + I've just checked how lighttpd compares to Zeus. - + lighttpd (current) (old) -c 10 20030525-1623 20030308-0155 Zeus 4_2 4k : 8166.60 9443.76 7278.55 @@ -3373,61 +3373,61 @@ For -c 100 4k and 100k sig-io gives a small increasment. 23.05.2003 14:38 - cgi-variables - + HTTP_HOST was missing for the cgi-module while the fcgi-module passed it through to the handler. Fixed that. - + - fcgi-errors - + the connection to the fcgi was dropped and poll() reported an error, the - error wasn't reported to the client the right way. - + error wasn't reported to the client the right way. + 22.05.2003 23:02 - authorization the first password-storage has been added: - + [auth] backend plan plain-userfile <filename> - + require /download/ user=jan|user=anom http-auth /download/ "download archiv" digest - + groups are prepared but not implemented. basic and digest are working fine. 20.05.2003 17:53 - authentification - - The auth-methods from RFC 2617 have been added. + + The auth-methods from RFC 2617 have been added. - auth basic - auth digest - + The only source for accounts is currently only the config-file. - + auth-digest needs the plain-text passwort. Are there any source which provide a plain-text password ? 12.05.2003 14:33 - virtual hosts - + added very basic virtual-host support - + virtual-server-root /home/weigon/projects/lighttpd/servers/ virtual-server-default-host grisu.home.kneschke.de:1025 virtual-server-docroot /pages/ - - docroot is - + + docroot is + - if http-host exists <virtual-server-root> + <http-host> + <virtual-server-docroot> - + - otherwise - <virtual-server-root> + <virtual-server-default-host> + + <virtual-server-root> + <virtual-server-default-host> + <virtual-server-docroot> - + - if even virtual-server-default-host does not exist, 500 is sent - + 12.05.2003 13:02 - code cleanup @@ -3435,33 +3435,33 @@ For -c 100 4k and 100k sig-io gives a small increasment. After two month of development it was time clean-up the internal structures. It looks like every went fine as lighttpd works es expected like before. - + - deflate - the on-the-fly compression has been verified to work fine with opera, + the on-the-fly compression has been verified to work fine with opera, konqui, mozilla and the IE. 12.05.2003 02:10 -- on-the-fly compression: deflate - +- on-the-fly compression: deflate + Why the hell are the defining a "deflate" encoding in the form of - - _deflate_ The "zlib" format defined in RFC 1950 [31] in combination - with the "deflate" compression mechanism described in RFC 1951 [29]. + + _deflate_ The "zlib" format defined in RFC 1950 [31] in combination + with the "deflate" compression mechanism described in RFC 1951 [29]. (RFC 2616) - + and noone implements it that way ? Konqui and Mozilla expect a plain - deflate() package without the zlib-header. - + deflate() package without the zlib-header. + Konqui is using "inflate2(..., -MAX_WBITS); " which is noted in the zlib - source as - + source as + /* handle undocumented nowrap option (no zlib header or check) */ - + Funny. Very, very funny. - - + + Anyway. We have mimetype-depended compression support now. - + 11.05.2003 21:56 - logging re-arranged the logfile structure to write CLF + useragent + referrer. @@ -3469,30 +3469,30 @@ For -c 100 4k and 100k sig-io gives a small increasment. 11.05.2003 10:23 - POST file-upload added the missing functionality to send more than a single packet to the - FCGI-Server (or Client ? ... the PHP). - + FCGI-Server (or Client ? ... the PHP). + This gives us the file-upload thing for eg. PHP and large user-forms (>16kb). 05.05.2003 15:21 - PATH_INFO - + added support for PATH_INFO. PHP is a little strange and doesn't trust the passed PATH_INFO setting. Works fine now. - + 30.04.2003 15:25 - bug-fixing day While testing the FastCGI interface with the MSIE Björn Schotte discovered - that sometimes the output repeats itself from the start in an endless loop. + that sometimes the output repeats itself from the start in an endless loop. This bug has been fixed. - + The read-write-fallback for ancient systems seeked the wrong FDs. - + The FastCGI handler is now separting the HTTP-Header from the response-body what results in a cleaner interface. The "header too long for caching" message is gone now. - + 28.04.2003 18:18 - chunked transfer-encoding @@ -3502,8 +3502,8 @@ For -c 100 4k and 100k sig-io gives a small increasment. 27.04.2003 23:10 - chunked transfer-encoding added "Transfer-Encoding: chunked" which is currently used in the web-chat - for the endless stream. Perhaps it helps some browsers. - + for the endless stream. Perhaps it helps some browsers. + The FastCGI interface will get a the chunked-support too, as it will enable keep-alive even if no content-length is returned from the FastCGI process. We know the size of the chunks and will report it to the browser. @@ -3512,14 +3512,14 @@ For -c 100 4k and 100k sig-io gives a small increasment. - gigE deatchmatch sascha compared the current lighttpd to his premium thttpd in his - gigabit-Ethernet-Network. + gigabit-Ethernet-Network. http://schumann.cx/gbit_deathmatch.txt small comment: lighttpd provides the same performance (req/s and thoughput), but uses more - CPU-Time. + CPU-Time. 10.04.2003 17:22 - works on IRIX @@ -3527,7 +3527,7 @@ href="http://schumann.cx/gbit_deathmatch.txt">http://schumann.cx/gbit_deathmatch Jörg Behrens provided me login to his SGI Origin and after fixing two small typos it worked fine on IRIX. (#if define HAVE... was missing a 'd' and getopt returns a 'int' and not a 'char') - + IPv6 support is currently disabled for IRIX a gethostbyname2() isn't available. @@ -3535,11 +3535,11 @@ href="http://schumann.cx/gbit_deathmatch.txt">http://schumann.cx/gbit_deathmatch - another bug-fixing day The upper limit of open connections was enforced and a caused a seg-fault. The current limit is set to 4096 parallel connections. - + As sascha benchmarked lighttpd and his premium thttpd I tried to reproduce his reported results and had to fix 2 flaws in the async-io handling of httpd_load which was used for the testing. - + If sascha starts another benchmark session I'll put a link to it here. 09.04.2003 00:08 @@ -3547,9 +3547,9 @@ href="http://schumann.cx/gbit_deathmatch.txt">http://schumann.cx/gbit_deathmatch Date: and Last-Modified: where sending a timezone != GMT what was invalid. The timestamp itself was correct, just the timezone use the wrong characters. - + the fcgi-code had an buffer-overflow for larger POST-Requests. - + The fcgi-code still has problems with POST-Request larger than 16kb as the the write buffer is full. Currently we don't handle this case except from reporting it in the error-log. @@ -3560,29 +3560,29 @@ href="http://schumann.cx/gbit_deathmatch.txt">http://schumann.cx/gbit_deathmatch The CGI Interface wasn't tested for a longer time. It don't really survived the introduction of the config-file handling and the internal changes that were part of it. - + A small test with - + #! /usr/bin/perl print "Content-Type: text/html\r\n\r\n"; print time()."\n"; 0; - produced 219 req/s. - + produced 219 req/s. + Calling PHP via the CGI interface results in 100 req/s. Same script, same parameters for 'ab' and same PHP result in 1400 req/s if we use the - FastCGI interface. - + FastCGI interface. + Don't forget: these benchmarks only represent figures for scenarios which are not very realistic. They are just usefull for comparisions of the internals. We don't want to benchmark applications. 01.04.2003 23:04 - new benchmarks - + This time we wanted to see if we can get the fastcgi-Interface a little bit - faster. We use this small script for the testing the interface. + faster. We use this small script for the testing the interface. <?php @@ -3603,8 +3603,8 @@ ob_end_flush(); 01.04.2003 19:28 (no april fools joke) - added SSL support - I took -lssl and -lcrypto and added SSLv2/SSLv3/TLS support to lighttpd. - + I took -lssl and -lcrypto and added SSLv2/SSLv3/TLS support to lighttpd. + After some reading I realisized that libcrypto contained some of my code. They have a similar buffer-struct with similar functions and they use the same MD5-code from the RFC. :) @@ -3612,8 +3612,8 @@ ob_end_flush(); Adding basic SSL-support was quite esay: replacing all write/read-calls by SSL_write/read, initializing the ssl-context the right way and telling openssl where to get the data from (SSL_set_fd). It fits really well into - lighttpd. - + lighttpd. + - sidenote sooner or later the con->filename handler will vanish in favour of the direct interface to the chunk-API which will simplifiy the design a little @@ -3621,12 +3621,12 @@ ob_end_flush(); 31.03.2003 20:50 - added a web-chat module - 1400 lines of C-code are neccesary to add a web-chat to lighttpd. - + 1400 lines of C-code are neccesary to add a web-chat to lighttpd. + Features: - bb-code for text-layouting - auto-highlight for URLs and Email-adresses - - unlimited number of channels + - unlimited number of channels - max. 32.000 users per channel - fast as it is directly integrated into the web-server - easy to install (as easy as lighttpd) @@ -3635,14 +3635,14 @@ ob_end_flush(); - uses as little JavaScript as possible to stay compatible with all browsers - flood-protection (2 Levels: ignore and kick) - uses CSS for customized look-and-feel - + 25.03.2003 00:36 - finished the config-file support - now we have config-sections - + now we have config-sections + [fastcgi] fastcgi .php 192.168.2.76 1025 - + The only this missing is -HUP handling to re-read the config. But that will follow when I'm up again. @@ -3653,52 +3653,52 @@ ob_end_flush(); 19.03.2003 03:05 - more on sendfile support - added support for freebsd's version of sendfile(). - + added support for freebsd's version of sendfile(). + Linux: ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count); - + FreeBSD: int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); - + the first 2 params are swap, the next 2 are the same and the last 3 are set to NULL or 0. - + Solaris 9 is providing a direct interface to the chunk-API with the sendfilev() system call: - - ssize_t sendfilev(int fildes, + + ssize_t sendfilev(int fildes, const struct sendfilevec *vec, int sfvcnt, size_t *xferred); - + recovering from a failure is a little bit more complex, but it should be fast. I just need a system to test it. Anyone ? 18.03.2003 17:32 - in the news - what a surprise: lighttpd is announced in entwickler.com. - + what a surprise: lighttpd is announced in entwickler.com. + http://www.entwickler.com/itr/news/psecom,id,9483,nodeid,82.html - + this was not planned. - - + + - implemented the chunked-API rather writing the content of multi-range'd requests to a temp-file we - just register the parts in a chunk-queue. - + just register the parts in a chunk-queue. + chunk 1 [mem] - part-header chunk 2 [file] - source-file (offset, len) chunk 3 [mem] - part-header chunk 4 [file] - source-file (offset, len) chunk 5 [mem] - part-footer - + If everything is prepared, the content-length is calculated and the http-header is generated and prepended to the chunk-queue. - + the handle_write() function which handles the write-process just sends the chunks to the network without only further modifications. - + the chunk-api even simplifies the 'my-fastcgi-process-needs-some-time-to-create-the-response- and-sends-the-data-in-chunks' case. Just add the chunk to the queue if it @@ -3706,11 +3706,11 @@ ob_end_flush(); 13.03.2003 10:49 - another set of real-life benchmarks - + the chairman was benchmarked a little bit. Chairman is full-flegded WCMS. As every CMS it needs some time to generate pages. To speed the page generating the static-parts of the page can be cached internally. - + without caching with caching apache + mod_php : 2.50 10.64 req/s lighttpd + fcgi-php: 2.50 22.74 req/s @@ -3725,11 +3725,11 @@ lighttpd + fcgi-php: 2.50 22.74 req/s - another large application works with lighttpd Chairman from thinkphp has been verified to work with lighttpd. - +href="http://www.thinkphp.de/content/content2.php?CatID=44&NewsID=95">Chairman from thinkphp has been verified to work with lighttpd. + Three things are worth to note: - - 1. ALWAYS use log_error in the php.ini if you use FastCGI + + 1. ALWAYS use log_error in the php.ini if you use FastCGI otherwise it will put the errormessages directly into fastcgi-socket without any FastCGI Header. This will result in strange errors. (its a PHP bug) @@ -3744,7 +3744,7 @@ href="http://www.thinkphp.de/content/content2.php?CatID=44&NewsID=95">Chairm 11.03.2003 00:13 - another target - after adding some headers lighttpd compiles without any warnings + after adding some headers lighttpd compiles without any warnings under cygwin on Windows. A native windows port will take some time as I have to figure out the @@ -3752,21 +3752,21 @@ href="http://www.thinkphp.de/content/content2.php?CatID=44&NewsID=95">Chairm 10.03.2003 11:52 - added Solaris 8 and 9 - lighttpd has been confirmed to compile and work on - - - linux + lighttpd has been confirmed to compile and work on + + - linux - FreeBSD, NetBSD - Solaris 8, 9 - + Perhaps I can get lcc to compile it on windows. 10.03.2003 01:30 - another platform was confirmed lighttpd works on NetBSD - + - another webserver benchmark mathopd (http://www.mathopd.org/) - + Mathopd/1.4 -c 10 4k : 6329.11 [#/sec] @@ -3776,7 +3776,7 @@ href="http://www.thinkphp.de/content/content2.php?CatID=44&NewsID=95">Chairm -c 100 4k : ---- (connections dropped) 4k (keep-alive) : ---- -100k : ---- +100k : ---- 100k (keep-alive) : ---- Very good values for small files, but the rest ? @@ -3786,11 +3786,11 @@ Very good values for small files, but the rest ? 1. sendfile (linux only) 2. mmap + write 3. read + write - + This means that lighttpd runs on some more systems. It has been verified to compile and work on linux 2.4.x and FreeBSD. - - + + -c 100 sendfile mmap read 4k 6476.68 5698.01 5363.08 [#/sec] @@ -3798,11 +3798,11 @@ Very good values for small files, but the rest ? The mmap() numbers could be better with a fd+mmap-cache. The zero-copy thing is good for our performance. - + - tested another small httpd - BOA just to get a better view about the performance of lighttpd i've tested another httpd: Boa/0.94.14rc16 (http://www.boa.org/) - + Boa/0.94.14rc16 -c 10 4k : 5659.63 [#/sec] @@ -3824,7 +3824,7 @@ Very good values for small files, but the rest ? 09.03.2003 13:26 - load-balancing works great - I used the framework from http://framework.netuse.de/ as a + I used the framework from http://framework.netuse.de/ as a real-life example again to test the load-balancer. setup: @@ -3832,57 +3832,57 @@ Very good values for small files, but the rest ? - AMD athlon XP 2000+ - runs lighttpd + ab + a 'nice -15'ed FastCGI-PHP - generates 153 req/s alone - + - laptop - Intel PIII 850 - runs a FastCGI-PHP - generates 88 req/s - - using the internal load-balancer of lighttpd which balances the + + using the internal load-balancer of lighttpd which balances the php-requests over grisu and laptop generate: 221 req/s - + An apache with mod_php running on grisu gives 117.04 req/s only. 09.03.2003 12:46 - building the connect connection to the fcgi-php is not non-blocking socket() -> connect() -> fcntl(non-blocking) resulted in some problems as - the connect() call blocked sometimes for 1 seconds. - + the connect() call blocked sometimes for 1 seconds. + socket() -> fcntl(non-blocking) -> connect() solves this problem, but - addes more overhead. The first connect-attempt seems always to + addes more overhead. The first connect-attempt seems always to return EINPROGRESS. - + 08.03.2003 15:06 -- the first 'real-life' PHP test showed 2 bugs in the POST handling. +- the first 'real-life' PHP test showed 2 bugs in the POST handling. 1. the Content-Type header was not forwarded via fastcgi 2. the internal content_length handler wasn't reset after the request - + now lighttpd + php work with - + http://framework.netuse.de/ - - the basic application gives us 145 req/s + + the basic application gives us 145 req/s 08.03.2003 11:06 - use diet to 'test' your code diet gives some use full warnings which should be followed. I took the chance and removed the last few fprintf() and sprintf() from the code. now, we don't need stdio.h anymore. - - a staticly linked, stripped lighttpd is 42884 bytes large. + + a staticly linked, stripped lighttpd is 42884 bytes large. 08.03.2003 01:55 - buffer_strcat() uses strlen() to get the length of the 'to-be-catted-string' if the string is constant or has a known length you can pass that function which gives use buffer_strcat_len() which passes the string length as a parameter. - + - using a ramdisk as the base for the tempfiles generated mkstemp() is a - very cood idea + very cood idea it reduces the io-load on the system and gives as more cpu-time for load-balancing the php-requests. - + - cache the output of strftime(), gmtime() and localtime we generate more then 10.000 req/s which results in using the same timestamp over and over again. It is sufficient to generate the timestamp @@ -3893,21 +3893,21 @@ Very good values for small files, but the rest ? - don't try to overoptimize for code for the sake of clean code the range support require some hack in the first versions like setting the - write_offset to the start of the range and keeping the rest of the - "code 200" send code as usual. Only a few lines added this first range - feature. fast, but a hack. It made things more complicated then neccesary + write_offset to the start of the range and keeping the rest of the + "code 200" send code as usual. Only a few lines added this first range + feature. fast, but a hack. It made things more complicated then neccesary to add multi-range support in this scenario. - + removing the hack doing small clean preprocessing helps to clean up the whole 'write a chunk on the wire' code. At the end we use less code and - have a cleaner design. - - Sascha proposed a chunked layer which just takes the chunks (http-header, + have a cleaner design. + + Sascha proposed a chunked layer which just takes the chunks (http-header, part-header, part-message, ... and the last boundary) and passes them to the write-to-the-wire-code. This is far more elegant and will perhaps same us from other problems, too. Currently I think that it is not necessary. First we have to fix some protability issues. - + Ok, today benches: today last @@ -3925,22 +3925,22 @@ Ok, today benches: Top Transfer Rate: 86365.77 [Kbytes/sec] received - + Too much for a GigE-link ? - + so far: - use state-engines - a non-forking webserver like described in - + a non-forking webserver like described in + http://www.kegel.com/c10k.html -- don't use fprintf() for logging. +- don't use fprintf() for logging. writing one line to log file takes more time that sending responsing the a HTTP-request - + - take care of your memory typedef struct { @@ -3948,7 +3948,7 @@ so far: size_t used; size_t size; } buffer; - + buffer* buffer_init(); void buffer_free(buffer *b); int buffer_prepare_copy(buffer *b, size_t size); @@ -3957,20 +3957,20 @@ so far: int buffer_strcpy_len(buffer *b, const char *s, int s_len); int buffer_strcat(buffer *b, const char *s); int buffer_strcat_len(buffer *b, const char *s, int s_len); - + buffer_init() is only called once per buffer. If you don't need the - buffer, set 'used' to zero and reused it afterward. + buffer, set 'used' to zero and reused it afterward. buffer_strcpy() + buffer_strcat() check if the 'used' + the new strlen() fit in to the 'size' of the buffer. If not the realloc() the buffer. buffer_strcat() uses memcpy(ptr + used - 1, s, s_len + 1); which should be faster than the original strcat(). - + Using those buffers keep the memory usage at 2Mb. malloc() and free() are only called at the beginnig of the programm and at the end. - + - don't used sprintf() to convert a integer into a string as like sprintf(buf, "%d", l); - + write your own ltostr function. sprintf() is to general for the case and is slow. @@ -3980,14 +3980,14 @@ Speed: Let's assume that thttpd is (one of) the -fastest webservers out there. +fastest webservers out there. all httpds were started with: $ ./thttpd -p 1026 -D \ -d /home/weigon/projects/localizer/src/lighttpd/docroot/ \ -l thttpd.access.log - + (lighttpd uses the same parameters). We used ApacheBench for testing the RPS (requests per second). @@ -4007,7 +4007,7 @@ $ /usr/sbin/ab -dS -c 10 -n 100000 http://192.168.2.10:80/dummy.out 100k (keep-a.) : 4035.35 893.51[3] 970.21 955.05 [#/sec] thttpd/2.21b+php has been patched with the keep-alive + php patches from PHP4 -sapi/thttpd/thttpd_patch. +sapi/thttpd/thttpd_patch. [1] ab reported: Failed requests: 1 diff --git a/INSTALL b/INSTALL index 1ecc9ed..f0ca061 100644 --- a/INSTALL +++ b/INSTALL @@ -10,7 +10,7 @@ Installation Installation ------------ -Get the source from +Get the source from http://www.lighttpd.net/download/ diff --git a/Makefile.am b/Makefile.am index dcd2605..3ed6331 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,3 @@ SUBDIRS=src doc tests cygwin openwrt -EXTRA_DIST=lighttpd.spec +EXTRA_DIST=lighttpd.spec diff --git a/Makefile.in b/Makefile.in index 8eea902..365738f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -126,7 +126,6 @@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ -LUACONFIG = @LUACONFIG@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LIBS = @LUA_LIBS@ MAINT = @MAINT@ @@ -159,6 +158,7 @@ SQLITE_LIBS = @SQLITE_LIBS@ SSL_LIB = @SSL_LIB@ STRIP = @STRIP@ U = @U@ +UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CFLAGS = @XML_CFLAGS@ XML_LIBS = @XML_LIBS@ @@ -212,7 +212,7 @@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ SUBDIRS = src doc tests cygwin openwrt -EXTRA_DIST = lighttpd.spec +EXTRA_DIST = lighttpd.spec all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive diff --git a/NEWS b/NEWS index ce33b15..0b52458 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,28 @@ NEWS ==== +- 1.4.13 - 2006-10-09 + + * added initgroups in spawn-fcgi (#871) + * added apr1 support htpasswd in mod-auth (#870) + * added lighty.stat() to mod_magnet + * fixed segfault in splitted CRLF CRLF sequences + (introduced in 1.4.12) (#876) + * fixed compilation of LOCK support in mod-webdav + * fixed fragments in request-URLs (#869) + * fixed pkg-config check for lua5.1 on debian + * fixed Content-Length = 0 on HEAD requests without + a known Content-Length (#119) + * fixed mkdir() forcing 0700 (#884) + * fixed writev() on FreeBSD 4.x and older (#875) + * removed warning about a 404-error-handler + returned 404 + * backported and fixed the buildsystem changes for + webdav locks + * fixed plugin loading so we can finally load lua + extensions in mod_magnet scripts + * fixed large uploads if xattr is enabled + - 1.4.12 - 2006-09-23 * added experimental LOCK support for webdav @@ -22,40 +44,40 @@ NEWS * fixed required trailing newline in configfiles (#142) * fixed quoting the autoconf files (#466) * fixed empty Host: + $HTTP["host"] handling (#458) - * fixed handling of If-Modified-Since if ETag is not set + * fixed handling of If-Modified-Since if ETag is not set * fixed default-shell if SHELL is not set (#441) * fixed appending and assigning of env.* vars * fixed empty FCGI_STDERR packets - * fixed conditional server.allow-http-11 + * fixed conditional server.allow-http-11 * fixed handling of follow-symlink + lstat() * fixed SIGHUP handling if max-workers is used * fixed "Software caused connection abort" messages on FreeBSD - 1.4.11 - 2006-03-09 - * added ability to specify which ip address spawn-fci listens on + * added ability to specify which ip address spawn-fci listens on (agkr@pobox.com) * added mod_flv_streaming to streaming Flash Movies efficiently - * fixed handling of error codes returned by mod_dav_svn behing a + * fixed handling of error codes returned by mod_dav_svn behing a mod_proxy * fixed error-messages in mod_auth and mod_fastcgi * fixed re-enabling overloaded local fastcgi backends * fixed handling of deleted files in linux-sendfile * fixed compilation on BSD and MacOSX * fixed $SERVER["socket"] on a already bound socket - * fixed local source retrieval on windows + * fixed local source retrieval on windows (secunia) - * fixed hanging cgi if remote side is dieing while reading + * fixed hanging cgi if remote side is dieing while reading from the pipe (sandy@meebo.com) - 1.4.10 - 2006-02-08 * added docs for mod_dirlisting * added fastcgi.map-extensions to mod_fastcgi - * fixed load balancing for mod_fastcgi + * fixed load balancing for mod_fastcgi * fixed extra newline for syslog() in mod_accesslog * fixed user-track cookie for IE in mod_usertrack - * fixed crash in digest handling in mod_auth + * fixed crash in digest handling in mod_auth * fixed handling of 301 response-bodies from a mod_proxy backend * fixed loading of base modules if server.modules is not set * fixed broken cgi if mod_scgi is loaded @@ -87,15 +109,15 @@ NEWS * added auto-reconnect to ldap-server in mod_auth (joerg@netbsd.org) - * changed auth.ldap-cafile to be optional + * changed auth.ldap-cafile to be optional (joerg@netbsd.org) * added strip_request_uri in mod_fastcgi * added more X-* headers to mod_proxy (Ben Grimm ) - * added 'debug' to simple-vhost to suppress the + * added 'debug' to simple-vhost to suppress the (mod_simple_vhost.c.157) No such file or directory /servers/ww.lighttpd.net/pages/ messages by default - * added support to let the server listen on UNIX-socket + * added support to let the server listen on UNIX-socket * changed default stat-cache-engine to 'simple' * removed debian/ dir from source package on request by packager * fixed max-age timestamps in mod_expire @@ -103,12 +125,12 @@ NEWS * fixed range request handling in network_writev * fixed retry on connect error in mod_fastcgi (Robert G. Jakabosky ) - * fixed possible crash in mod_webdav if sqlite3 support + * fixed possible crash in mod_webdav if sqlite3 support is available but not use * fixed fdvent-handler init if server.max-worker was used (Siddharth Vijayakrishnan ) * fixed missing cleanup in mysql_vhost - * fixed assert() in "connections.c:962: + * fixed assert() in "connections.c:962: connection_handle_read_state: Assertion 'c->mem->used' failed." * fixed 64bit issue in md5 * fixed crash in mod_status @@ -127,13 +149,13 @@ NEWS * added madvise() to instruct the kernel the do proper read-ahead in network_writev * added support for %I in mod_accesslog * added better compat to Apache for ?auto in mod_status - * added support for userdirs without a entry in /etc/passwd in mod_userdir + * added support for userdirs without a entry in /etc/passwd in mod_userdir (rob@inversepath.com) * added startup-time selectable network-backend * added location of upload-files to config as array * added webdav.log-xml for logging xml-content in mod_webdav * added Cache-Control: max-age to mod_expire - * workaround missing client-bug by assuming we received a close-notify on + * workaround missing client-bug by assuming we received a close-notify on non-keep-alive requests in SSL request * disabled kerberos5 support by default to fix compilation on RHEL * fixed order of library checks to fix compilation on Solaris 9 @@ -184,10 +206,10 @@ NEWS - 1.4.3 - 2005-09-01 * added gracefull shutdown - * added server.max-connections + * added server.max-connections * fixed compilation on all BSD platforms * fixed init of kqueue and /dev/poll after daemonize - * fixed segfault if select() is event-handler and more than FD_SETSIZE + * fixed segfault if select() is event-handler and more than FD_SETSIZE fds are opened * fixed compilation of mod_cml * fixed bin-copy-env in mod_fastcgi @@ -207,13 +229,13 @@ NEWS * added a complete Class 1 complient mod_webdav * fixed ssl support (especially on OpenBSD) * fixed response header in body problem in mod_cgi - * fixed numbers before body problem + * fixed numbers before body problem * fixed compilation on Solaris and FreeBSD * fixed conditional options in mod_dirlisting * fixed segfault in mod_dirlisting for NFS directories * fixed check for docroot in change-root environments -- 1.4.0 - 2005-08-17 +- 1.4.0 - 2005-08-17 * added nested conditionals * added remote-ip to $HTTP @@ -229,7 +251,7 @@ NEWS * added support for accesslog to syslog * added support for PATH_INFO guessing if check-local is disabled in mod_fastcgi - * added switch to disable range-requests + * added switch to disable range-requests * added valid-user option for mod_auth (tigger at gentoo.org) * added JavaScript based sorting to mod_status (erik) * added selective TCP_CORK (Christian von Roques) @@ -242,7 +264,7 @@ NEWS - 1.3.15 - 2005-07-15 - * added mod_cml + * added mod_cml * added mod_trigger_b4_dl * added encoding to mod_dirlisting * added ?auto to mod_status @@ -285,7 +307,7 @@ NEWS * added REMOTE_PORT and SERVER_ADDR to CGI-env * relaxed handling of newlines before keep-alive requests * relaxed uri-parser again - * fixed PHP_SELF for php + * fixed PHP_SELF for php * fixed compilation on MacOS X * fixed handling of EPIPE and ECONNRESET * fixed crash in mod_auth if config-options are missing @@ -299,7 +321,7 @@ NEWS * added support for full commandline in spawn-fcgi * fixed missing check for IP-address in mod_fastcgi * fixed compile error with openssl in mod_fastcgi - * removed a debug-message from network-functions + * removed a debug-message from network-functions - 1.3.9 - 2005-02-06 @@ -311,9 +333,9 @@ NEWS * fixed min-procs and max-procs in FastCGI on PowerPC * fixed crash in setenv.add-response-header * fixed handling of nph-scripts in CGI - * fixed accidently sending out physical file in CGI on error + * fixed accidently sending out physical file in CGI on error * fixed cygwin support - * fixed handling of missing files + * fixed handling of missing files * fixed HEAD requests for dynamic requests - 1.3.8 - 2005-01-30 @@ -328,22 +350,22 @@ NEWS * fixed build problems on netbsd 1.4.x and 1.5.x * fixed status.url configuration * fixed handling of != and !~ in configutation - * fixed special cases in keep-alive handling + * fixed special cases in keep-alive handling * fixed timeout handling in handling POST requests - * fixed mode AUTHORIZER in FastCGI + * fixed mode AUTHORIZER in FastCGI * fixed handling if internal redirects if no Host: is supplied - * fixed mod_alias + pathinfo + * fixed mod_alias + pathinfo * fixed directory indexes and permissions * enabled sending errorlog to syslog again - 1.3.7 - 2004-12-11 - * added retries for a fastcgi connect if a php-childs + * added retries for a fastcgi connect if a php-childs dies at startup * update the debian directory * added setgroups() to drop all group-privs * added native port to windows via mingw32 - * added server.tag = '...' + * added server.tag = '...' * added support for ${...} in mod_ssi * ported all plugins to conditional support * fixed multipart handling in cgi @@ -357,10 +379,10 @@ NEWS - 1.3.6 - 2004-11-03 * added spawn-fcgi to the distribution - * added support in fastcgi module to spawn fastcgi + * added support in fastcgi module to spawn fastcgi processes itself * fixed logfile cycling if external logging is used - * fixed connection handling in fastcgi if no chunk + * fixed connection handling in fastcgi if no chunk encoding is used * fixed internal redirects on directories if a query string is supplied @@ -369,7 +391,7 @@ NEWS - 1.3.5 - 2004-10-31 - * added mod_alias + * added mod_alias * added mod_userdir * added the exec command to the SSI handler * added a switch to disable follow-symlinks @@ -385,12 +407,12 @@ NEWS * added build target for OpenWRT * added plain backend support for auth-digest * fixed handling the external accesslog processes - * fixed SERVER_NAME in CGI and FastCGI + * fixed SERVER_NAME in CGI and FastCGI - 1.3.3 - 2004-10-16 * added support for NL terminators in CGI-scripts - * added support for conditionals in mod_auth, + * added support for conditionals in mod_auth, mod_simple_vhost and mod_evhost * added a error-handler for 404 codes * fixed request counter in the rrdtool module @@ -494,7 +516,7 @@ NEWS - 1.2.0 - 2004-05-17 * added conforming Expect: handling - * added a module for secure and fast downloading + * added a module for secure and fast downloading * rewrote the event handling interface * fixed array handling which might lead to 'missing header' * fixed pipelining support diff --git a/README b/README index 5a70155..318da22 100644 --- a/README +++ b/README @@ -12,7 +12,7 @@ a light httpd :Revision: $Revision: 1.8 $ :abstract: - lighttpd a secure, fast, compliant and very flexible web-server + lighttpd a secure, fast, compliant and very flexible web-server which has been optimized for high-performance environments. It has a very low memory footprint compared to other webservers and takes care of cpu-load. Its advanced feature-set (FastCGI, CGI, Auth, Output-Compression, @@ -22,7 +22,7 @@ a light httpd the naming ---------- -lighttpd is a __httpd__ which is +lighttpd is a __httpd__ which is - fast as __light__ning and - __light__ when it comes to memory consumption and system requirements @@ -50,7 +50,7 @@ Advanced Features - load-balanced FastCGI (one webserver distributes requests to multiple PHP-servers via FastCGI) - custom error pages (for Response-Code 400-599) -- virtual hosts +- virtual hosts - directory listings - streaming CGI and FastCGI - URL-Rewriting @@ -71,18 +71,18 @@ PHP-Support - includes a utility to spawn FastCGI processes (necessary for PHP 4.3.x) Security features -````````````````` +````````````````` - chroot(), set UID, set GID - protecting docroot HTTP/1.1 features -````````````````` +````````````````` - Ranges (start-end, start-, -end, multiple ranges) - HTTP/1.0 Keep-Alive + HTTP/1.1 persistent Connections - methods: GET, HEAD, POST -- Last-Modified + If-Modified handling +- Last-Modified + If-Modified handling - sends Content-Length if possible - sends Transfer-Encoding: chunk, if Content-Length is not possible - sends Content-Type @@ -91,7 +91,7 @@ HTTP/1.1 features (http://www.ietf.org/rfc/rfc2617.txt) HTTP/1.1 compliance -``````````````````` +``````````````````` - Sends 206 for Range Requests - Sends 304 for If-Modified Requests @@ -101,7 +101,7 @@ HTTP/1.1 compliance - Sends 416 for "out-of-range" on Range: Header - Sends 501 for request-method != (GET|POST|HEAD) - Sends 505 for protocol != HTTP/1.0 or HTTP/1.1 -- Sends Date: on every requests +- Sends Date: on every requests Intended Audience ----------------- @@ -118,14 +118,14 @@ It has been tested to work with - IE 6.0 - Mozilla 1.x -- Konqueror 3.1 +- Konqueror 3.1 (for Keep-Alive/Persistent Connections, Accept-Encoding for PHP + gzip) -- wget +- wget (for Resuming) - acrobat plugin (for multiple ranges) - - + + Works on -------- diff --git a/config.h.in b/config.h.in index 068a8b1..36f3ab7 100644 --- a/config.h.in +++ b/config.h.in @@ -33,6 +33,9 @@ /* fam.h */ #undef HAVE_FAM_H +/* Define to 1 if you have the header file. */ +#undef HAVE_FASTCGI_FASTCGI_H + /* Define to 1 if you have the header file. */ #undef HAVE_FASTCGI_H @@ -331,6 +334,15 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* libuuid */ +#undef HAVE_UUID + +/* uuid/uuid.h is available */ +#undef HAVE_UUID_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UUID_UUID_H + /* Define to 1 if you have the header file. */ #undef HAVE_VALGRIND_VALGRIND_H diff --git a/configure b/configure index 475c381..bb6b718 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for lighttpd 1.4.12. +# Generated by GNU Autoconf 2.59 for lighttpd 1.4.13. # # Report bugs to . # @@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='lighttpd' PACKAGE_TARNAME='lighttpd' -PACKAGE_VERSION='1.4.12' -PACKAGE_STRING='lighttpd 1.4.12' +PACKAGE_VERSION='1.4.13' +PACKAGE_STRING='lighttpd 1.4.13' PACKAGE_BUGREPORT='jan@kneschke.de' ac_unique_file="src/server.c" @@ -465,7 +465,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP CPP LN_S NO_RDYNAMIC_TRUE NO_RDYNAMIC_FALSE U ANSI2KNR ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS MYSQL_CONFIG MYSQL_LIBS MYSQL_INCLUDE LDAP_LIB LBER_LIB ATTR_LIB DL_LIB SSL_LIB PCRECONFIG PCRE_LIB Z_LIB BZ_LIB PKG_CONFIG ac_pt_PKG_CONFIG FAM_CFLAGS FAM_LIBS XML_CFLAGS XML_LIBS SQLITE_CFLAGS SQLITE_LIBS GDBM_LIB MEMCACHE_LIB LUACONFIG LUA_CFLAGS LUA_LIBS CRYPT_LIB SENDFILE_LIB CROSS_COMPILING_TRUE CROSS_COMPILING_FALSE CHECK_WITH_FASTCGI_TRUE CHECK_WITH_FASTCGI_FALSE LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP CPP LN_S NO_RDYNAMIC_TRUE NO_RDYNAMIC_FALSE U ANSI2KNR ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS MYSQL_CONFIG MYSQL_LIBS MYSQL_INCLUDE LDAP_LIB LBER_LIB ATTR_LIB DL_LIB SSL_LIB PCRECONFIG PCRE_LIB Z_LIB BZ_LIB PKG_CONFIG ac_pt_PKG_CONFIG FAM_CFLAGS FAM_LIBS XML_CFLAGS XML_LIBS SQLITE_CFLAGS SQLITE_LIBS UUID_LIBS GDBM_LIB MEMCACHE_LIB LUA_CFLAGS LUA_LIBS CRYPT_LIB SENDFILE_LIB CROSS_COMPILING_TRUE CROSS_COMPILING_FALSE CHECK_WITH_FASTCGI_TRUE CHECK_WITH_FASTCGI_FALSE LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -990,7 +990,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures lighttpd 1.4.12 to adapt to many kinds of systems. +\`configure' configures lighttpd 1.4.13 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1057,7 +1057,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of lighttpd 1.4.12:";; + short | recursive ) echo "Configuration of lighttpd 1.4.13:";; esac cat <<\_ACEOF @@ -1102,6 +1102,7 @@ Optional Packages: --with-bzip2 Enable bzip2 support for mod_compress --with-fam fam/gamin for reducing number of stat() calls --with-webdav-props properties in mod_webdav + --with-webdav-locks locks in mod_webdav --with-gdbm gdbm storage for mod_trigger_b4_dl --with-memcache memcached storage for mod_trigger_b4_dl --with-lua lua engine for mod_cml @@ -1229,7 +1230,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -lighttpd configure 1.4.12 +lighttpd configure 1.4.13 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1243,7 +1244,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by lighttpd $as_me 1.4.12, which was +It was created by lighttpd $as_me 1.4.13, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1971,7 +1972,7 @@ fi # Define the identity of the package. PACKAGE='lighttpd' - VERSION='1.4.12' + VERSION='1.4.13' cat >>confdefs.h <<_ACEOF @@ -4927,7 +4928,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4930 "configure"' > conftest.$ac_ext + echo '#line 4931 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6033,7 +6034,7 @@ fi # Provide some information about the compiler. -echo "$as_me:6036:" \ +echo "$as_me:6037:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -7131,11 +7132,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7134: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7135: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7138: \$? = $ac_status" >&5 + echo "$as_me:7139: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7393,11 +7394,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7396: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7397: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7400: \$? = $ac_status" >&5 + echo "$as_me:7401: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7455,11 +7456,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7458: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7459: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7462: \$? = $ac_status" >&5 + echo "$as_me:7463: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8840,7 +8841,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 8843 "configure"' > conftest.$ac_ext + echo '#line 8844 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -9711,7 +9712,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:12061: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12064: \$? = $ac_status" >&5 + echo "$as_me:12065: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12119,11 +12120,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12122: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12123: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12126: \$? = $ac_status" >&5 + echo "$as_me:12127: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12634,7 +12635,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 12637 "configure"' > conftest.$ac_ext + echo '#line 12638 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -13505,7 +13506,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:14492: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14495: \$? = $ac_status" >&5 + echo "$as_me:14496: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14550,11 +14551,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14553: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14554: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14557: \$? = $ac_status" >&5 + echo "$as_me:14558: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15915,7 +15916,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 15918 "configure"' > conftest.$ac_ext + echo '#line 15919 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -16688,11 +16689,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16691: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16692: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16695: \$? = $ac_status" >&5 + echo "$as_me:16696: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16950,11 +16951,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16953: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16954: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16957: \$? = $ac_status" >&5 + echo "$as_me:16958: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17012,11 +17013,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17015: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17016: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17019: \$? = $ac_status" >&5 + echo "$as_me:17020: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -18397,7 +18398,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 18400 "configure"' > conftest.$ac_ext + echo '#line 18401 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -19268,7 +19269,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <>confdefs.h <<\_ACEOF _ACEOF -fi fi -echo "$as_me:$LINENO: checking for gdbm" >&5 -echo $ECHO_N "checking for gdbm... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking for locks in mod_webdav" >&5 +echo $ECHO_N "checking for locks in mod_webdav... $ECHO_C" >&6 -# Check whether --with-gdbm or --without-gdbm was given. -if test "${with_gdbm+set}" = set; then - withval="$with_gdbm" - WITH_GDBM=$withval +# Check whether --with-webdav-locks or --without-webdav-locks was given. +if test "${with_webdav_locks+set}" = set; then + withval="$with_webdav_locks" + WITH_WEBDAV_LOCKS=$withval else - WITH_GDBM=no + WITH_WEBDAV_LOCKS=no fi; -echo "$as_me:$LINENO: result: $WITH_GDBM" >&5 -echo "${ECHO_T}$WITH_GDBM" >&6 + echo "$as_me:$LINENO: result: $WITH_WEBDAV_LOCKS" >&5 +echo "${ECHO_T}$WITH_WEBDAV_LOCKS" >&6 -if test "$WITH_GDBM" != "no"; then - echo "$as_me:$LINENO: checking for gdbm_open in -lgdbm" >&5 -echo $ECHO_N "checking for gdbm_open in -lgdbm... $ECHO_C" >&6 -if test "${ac_cv_lib_gdbm_gdbm_open+set}" = set; then + if test "$WITH_WEBDAV_LOCKS" != "no"; then + echo "$as_me:$LINENO: checking for uuid_unparse in -luuid" >&5 +echo $ECHO_N "checking for uuid_unparse in -luuid... $ECHO_C" >&6 +if test "${ac_cv_lib_uuid_uuid_unparse+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lgdbm $LIBS" +LIBS="-luuid $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -26263,11 +26264,11 @@ extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char gdbm_open (); +char uuid_unparse (); int main () { -gdbm_open (); +uuid_unparse (); ; return 0; } @@ -26294,23 +26295,23 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_gdbm_gdbm_open=yes + ac_cv_lib_uuid_uuid_unparse=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_gdbm_gdbm_open=no +ac_cv_lib_uuid_uuid_unparse=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_gdbm_gdbm_open" >&5 -echo "${ECHO_T}$ac_cv_lib_gdbm_gdbm_open" >&6 -if test $ac_cv_lib_gdbm_gdbm_open = yes; then +echo "$as_me:$LINENO: result: $ac_cv_lib_uuid_uuid_unparse" >&5 +echo "${ECHO_T}$ac_cv_lib_uuid_uuid_unparse" >&6 +if test $ac_cv_lib_uuid_uuid_unparse = yes; then -for ac_header in gdbm.h +for ac_header in uuid/uuid.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -26455,14 +26456,15 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF - GDBM_LIB=-lgdbm + UUID_LIBS=-luuid cat >>confdefs.h <<\_ACEOF -#define HAVE_GDBM 1 +#define HAVE_UUID 1 _ACEOF - cat >>confdefs.h <<\_ACEOF -#define HAVE_GDBM_H 1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_UUID_H 1 _ACEOF @@ -26474,28 +26476,31 @@ done fi + fi fi -echo "$as_me:$LINENO: checking for memcache" >&5 -echo $ECHO_N "checking for memcache... $ECHO_C" >&6 -# Check whether --with-memcache or --without-memcache was given. -if test "${with_memcache+set}" = set; then - withval="$with_memcache" - WITH_MEMCACHE=$withval +echo "$as_me:$LINENO: checking for gdbm" >&5 +echo $ECHO_N "checking for gdbm... $ECHO_C" >&6 + +# Check whether --with-gdbm or --without-gdbm was given. +if test "${with_gdbm+set}" = set; then + withval="$with_gdbm" + WITH_GDBM=$withval else - WITH_MEMCACHE=no + WITH_GDBM=no fi; -echo "$as_me:$LINENO: result: $WITH_MEMCACHE" >&5 -echo "${ECHO_T}$WITH_MEMCACHE" >&6 -if test "$WITH_MEMCACHE" != "no"; then - echo "$as_me:$LINENO: checking for mc_new in -lmemcache" >&5 -echo $ECHO_N "checking for mc_new in -lmemcache... $ECHO_C" >&6 -if test "${ac_cv_lib_memcache_mc_new+set}" = set; then +echo "$as_me:$LINENO: result: $WITH_GDBM" >&5 +echo "${ECHO_T}$WITH_GDBM" >&6 + +if test "$WITH_GDBM" != "no"; then + echo "$as_me:$LINENO: checking for gdbm_open in -lgdbm" >&5 +echo $ECHO_N "checking for gdbm_open in -lgdbm... $ECHO_C" >&6 +if test "${ac_cv_lib_gdbm_gdbm_open+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lmemcache $LIBS" +LIBS="-lgdbm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -26509,11 +26514,11 @@ extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char mc_new (); +char gdbm_open (); int main () { -mc_new (); +gdbm_open (); ; return 0; } @@ -26540,23 +26545,23 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_memcache_mc_new=yes + ac_cv_lib_gdbm_gdbm_open=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_memcache_mc_new=no +ac_cv_lib_gdbm_gdbm_open=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_memcache_mc_new" >&5 -echo "${ECHO_T}$ac_cv_lib_memcache_mc_new" >&6 -if test $ac_cv_lib_memcache_mc_new = yes; then +echo "$as_me:$LINENO: result: $ac_cv_lib_gdbm_gdbm_open" >&5 +echo "${ECHO_T}$ac_cv_lib_gdbm_gdbm_open" >&6 +if test $ac_cv_lib_gdbm_gdbm_open = yes; then -for ac_header in memcache.h +for ac_header in gdbm.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -26701,15 +26706,14 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF - MEMCACHE_LIB=-lmemcache + GDBM_LIB=-lgdbm cat >>confdefs.h <<\_ACEOF -#define HAVE_MEMCACHE 1 +#define HAVE_GDBM 1 _ACEOF - -cat >>confdefs.h <<\_ACEOF -#define HAVE_MEMCACHE_H 1 + cat >>confdefs.h <<\_ACEOF +#define HAVE_GDBM_H 1 _ACEOF @@ -26723,81 +26727,26 @@ fi fi -echo "$as_me:$LINENO: checking if lua-support is requested" >&5 -echo $ECHO_N "checking if lua-support is requested... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking for memcache" >&5 +echo $ECHO_N "checking for memcache... $ECHO_C" >&6 -# Check whether --with-lua or --without-lua was given. -if test "${with_lua+set}" = set; then - withval="$with_lua" - WITH_LUA=$withval +# Check whether --with-memcache or --without-memcache was given. +if test "${with_memcache+set}" = set; then + withval="$with_memcache" + WITH_MEMCACHE=$withval else - WITH_LUA=no + WITH_MEMCACHE=no fi; - -echo "$as_me:$LINENO: result: $WITH_LUA" >&5 -echo "${ECHO_T}$WITH_LUA" >&6 -if test "$WITH_LUA" != "no"; then - # Extract the first word of "lua-config", so it can be a program name with args. -set dummy lua-config; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_LUACONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $LUACONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_LUACONFIG="$LUACONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_LUACONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -LUACONFIG=$ac_cv_path_LUACONFIG - -if test -n "$LUACONFIG"; then - echo "$as_me:$LINENO: result: $LUACONFIG" >&5 -echo "${ECHO_T}$LUACONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - - if test x"$LUACONFIG" != x; then - LUA_CFLAGS=`$LUACONFIG --include` - LUA_LIBS=`$LUACONFIG --libs --extralibs` - -cat >>confdefs.h <<\_ACEOF -#define HAVE_LUA 1 -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define HAVE_LUA_H 1 -_ACEOF - - else - echo "$as_me:$LINENO: checking for lua_open in -llua" >&5 -echo $ECHO_N "checking for lua_open in -llua... $ECHO_C" >&6 -if test "${ac_cv_lib_lua_lua_open+set}" = set; then +echo "$as_me:$LINENO: result: $WITH_MEMCACHE" >&5 +echo "${ECHO_T}$WITH_MEMCACHE" >&6 +if test "$WITH_MEMCACHE" != "no"; then + echo "$as_me:$LINENO: checking for mc_new in -lmemcache" >&5 +echo $ECHO_N "checking for mc_new in -lmemcache... $ECHO_C" >&6 +if test "${ac_cv_lib_memcache_mc_new+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-llua $LIBS" +LIBS="-lmemcache $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -26811,11 +26760,11 @@ extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char lua_open (); +char mc_new (); int main () { -lua_open (); +mc_new (); ; return 0; } @@ -26842,23 +26791,23 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_lua_lua_open=yes + ac_cv_lib_memcache_mc_new=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_lua_lua_open=no +ac_cv_lib_memcache_mc_new=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_lua_lua_open" >&5 -echo "${ECHO_T}$ac_cv_lib_lua_lua_open" >&6 -if test $ac_cv_lib_lua_lua_open = yes; then +echo "$as_me:$LINENO: result: $ac_cv_lib_memcache_mc_new" >&5 +echo "${ECHO_T}$ac_cv_lib_memcache_mc_new" >&6 +if test $ac_cv_lib_memcache_mc_new = yes; then -for ac_header in lua.h +for ac_header in memcache.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -27003,15 +26952,15 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF - LUA_LIBS="-llua -llualib" + MEMCACHE_LIB=-lmemcache cat >>confdefs.h <<\_ACEOF -#define HAVE_LUA 1 +#define HAVE_MEMCACHE 1 _ACEOF cat >>confdefs.h <<\_ACEOF -#define HAVE_LUA_H 1 +#define HAVE_MEMCACHE_H 1 _ACEOF @@ -27022,10 +26971,26 @@ done fi - fi - if test x"$LUA_LIBS" = x; then - # try pkgconfig +fi + +echo "$as_me:$LINENO: checking if lua-support is requested" >&5 +echo $ECHO_N "checking if lua-support is requested... $ECHO_C" >&6 + +# Check whether --with-lua or --without-lua was given. +if test "${with_lua+set}" = set; then + withval="$with_lua" + WITH_LUA=$withval +else + WITH_LUA=no +fi; + +echo "$as_me:$LINENO: result: $WITH_LUA" >&5 +echo "${ECHO_T}$WITH_LUA" >&6 +if test "$WITH_LUA" != "no"; then + if test "$WITH_LUA" == "yes"; then + WITH_LUA=lua + fi pkg_failed=no echo "$as_me:$LINENO: checking for LUA" >&5 @@ -27036,12 +27001,12 @@ if test -n "$PKG_CONFIG"; then pkg_cv_LUA_CFLAGS="$LUA_CFLAGS" else if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"lua >= 5.0\"") >&5 - ($PKG_CONFIG --exists --print-errors "lua >= 5.0") 2>&5 + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\$WITH_LUA >= 5.1\"") >&5 + ($PKG_CONFIG --exists --print-errors "$WITH_LUA >= 5.1") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_LUA_CFLAGS=`$PKG_CONFIG --cflags "lua >= 5.0" 2>/dev/null` + pkg_cv_LUA_CFLAGS=`$PKG_CONFIG --cflags "$WITH_LUA >= 5.1" 2>/dev/null` else pkg_failed=yes fi @@ -27054,12 +27019,12 @@ if test -n "$PKG_CONFIG"; then pkg_cv_LUA_LIBS="$LUA_LIBS" else if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"lua >= 5.0\"") >&5 - ($PKG_CONFIG --exists --print-errors "lua >= 5.0") 2>&5 + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\$WITH_LUA >= 5.1\"") >&5 + ($PKG_CONFIG --exists --print-errors "$WITH_LUA >= 5.1") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_LUA_LIBS=`$PKG_CONFIG --libs "lua >= 5.0" 2>/dev/null` + pkg_cv_LUA_LIBS=`$PKG_CONFIG --libs "$WITH_LUA >= 5.1" 2>/dev/null` else pkg_failed=yes fi @@ -27078,14 +27043,14 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - LUA_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "lua >= 5.0"` + LUA_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$WITH_LUA >= 5.1"` else - LUA_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "lua >= 5.0"` + LUA_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$WITH_LUA >= 5.1"` fi # Put the nasty error message in config.log where it belongs echo "$LUA_PKG_ERRORS" >&5 - { { echo "$as_me:$LINENO: error: Package requirements (lua >= 5.0) were not met: + { { echo "$as_me:$LINENO: error: Package requirements ($WITH_LUA >= 5.1) were not met: $LUA_PKG_ERRORS @@ -27096,7 +27061,7 @@ Alternatively, you may set the environment variables LUA_CFLAGS and LUA_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " >&5 -echo "$as_me: error: Package requirements (lua >= 5.0) were not met: +echo "$as_me: error: Package requirements ($WITH_LUA >= 5.1) were not met: $LUA_PKG_ERRORS @@ -27148,7 +27113,6 @@ _ACEOF fi - fi @@ -28814,7 +28778,8 @@ echo "${ECHO_T}$ac_cv_lib_fcgi_FCGI_Accept" >&6 if test $ac_cv_lib_fcgi_FCGI_Accept = yes; then -for ac_header in fastcgi.h + +for ac_header in fastcgi.h fastcgi/fastcgi.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -28982,7 +28947,7 @@ fi if test "${GCC}" = "yes"; then - CFLAGS="${CFLAGS} -Wall -W -Wshadow -pedantic" + CFLAGS="${CFLAGS} -Wall -W -Wshadow -pedantic -std=gnu99" fi LIGHTTPD_VERSION_ID=`echo $PACKAGE_VERSION | $AWK -F '.' '{print "(" $1 " << 16 | " $2 " << 8 | " $3 ")"}'` @@ -29405,7 +29370,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by lighttpd $as_me 1.4.12, which was +This file was extended by lighttpd $as_me 1.4.13, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -29468,7 +29433,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -lighttpd config.status 1.4.12 +lighttpd config.status 1.4.13 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -29779,9 +29744,9 @@ s,@XML_CFLAGS@,$XML_CFLAGS,;t t s,@XML_LIBS@,$XML_LIBS,;t t s,@SQLITE_CFLAGS@,$SQLITE_CFLAGS,;t t s,@SQLITE_LIBS@,$SQLITE_LIBS,;t t +s,@UUID_LIBS@,$UUID_LIBS,;t t s,@GDBM_LIB@,$GDBM_LIB,;t t s,@MEMCACHE_LIB@,$MEMCACHE_LIB,;t t -s,@LUACONFIG@,$LUACONFIG,;t t s,@LUA_CFLAGS@,$LUA_CFLAGS,;t t s,@LUA_LIBS@,$LUA_LIBS,;t t s,@CRYPT_LIB@,$CRYPT_LIB,;t t @@ -30612,6 +30577,14 @@ else disable_feature="$disable_feature $features" fi +features="webdav-locks" +if test "x$UUID_LIBS" \!= x; then + enable_feature="$enable_feature $features" +else + disable_feature="$disable_feature $features" +fi + + ## output $ECHO diff --git a/configure.in b/configure.in index 74bca03..f0c789f 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.57) -AC_INIT(lighttpd, 1.4.12, jan@kneschke.de) +AC_INIT(lighttpd, 1.4.13, jan@kneschke.de) AC_CONFIG_SRCDIR([src/server.c]) AC_CANONICAL_TARGET @@ -40,13 +40,13 @@ dnl more automake stuff AM_C_PROTOTYPES dnl libtool -AC_DISABLE_STATIC +AC_DISABLE_STATIC AC_ENABLE_SHARED AC_LIBTOOL_DLOPEN AC_PROG_LIBTOOL -dnl for solaris +dnl for solaris CPPFLAGS="${CPPFLAGS} -D_REENTRANT -D__EXTENSIONS__" # Checks for header files. @@ -56,7 +56,7 @@ AC_CHECK_HEADERS([arpa/inet.h fcntl.h netinet/in.h stdlib.h string.h \ sys/socket.h sys/time.h unistd.h sys/sendfile.h sys/uio.h \ getopt.h sys/epoll.h sys/select.h poll.h sys/poll.h sys/devpoll.h sys/filio.h \ sys/mman.h sys/event.h sys/port.h pwd.h sys/syslimits.h \ -sys/resource.h sys/un.h syslog.h sys/prctl.h]) +sys/resource.h sys/un.h syslog.h sys/prctl.h uuid/uuid.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -90,7 +90,7 @@ AC_ARG_WITH(mysql, [WITH_MYSQL=$withval],[WITH_MYSQL=no]) if test "$WITH_MYSQL" != "no"; then - AC_MSG_RESULT(yes) + AC_MSG_RESULT(yes) if test "$WITH_MYSQL" = "yes"; then AC_PATH_PROG(MYSQL_CONFIG, mysql_config) else @@ -237,8 +237,8 @@ if test "x$use_openssl" = "xyes"; then AC_CHECK_HEADERS([openssl/ssl.h]) OLDLIBS="$LIBS" - AC_CHECK_LIB(crypto, BIO_f_base64, [ - AC_CHECK_LIB(ssl, SSL_new, [ SSL_LIB="-lssl -lcrypto" + AC_CHECK_LIB(crypto, BIO_f_base64, [ + AC_CHECK_LIB(ssl, SSL_new, [ SSL_LIB="-lssl -lcrypto" AC_DEFINE(HAVE_LIBSSL, [], [Have libssl]) ], [], [ -lcrypto "$DL_LIB" ]) ], [], []) LIBS="$OLDLIBS" @@ -253,7 +253,7 @@ AC_MSG_RESULT([$WITH_PCRE]) if test "x$cross_compiling" = xno -a "$WITH_PCRE" != "no"; then AC_PATH_PROG(PCRECONFIG, pcre-config) - if test x"$PCRECONFIG" != x; then + if test x"$PCRECONFIG" != x; then PCRE_LIB=`$PCRECONFIG --libs` CPPFLAGS="$CPPFLAGS `$PCRECONFIG --cflags`" OLDLIBS="$LIBS" @@ -339,7 +339,24 @@ if test "$WITH_WEBDAV_PROPS" != "no"; then AC_DEFINE([HAVE_SQLITE3], [1], [libsqlite3]) AC_DEFINE([HAVE_SQLITE3_H], [1], [sqlite3.h]) ]) + + AC_MSG_CHECKING(for locks in mod_webdav) + AC_ARG_WITH(webdav-locks, AC_HELP_STRING([--with-webdav-locks],[locks in mod_webdav]), + [WITH_WEBDAV_LOCKS=$withval],[WITH_WEBDAV_LOCKS=no]) + AC_MSG_RESULT([$WITH_WEBDAV_LOCKS]) + + if test "$WITH_WEBDAV_LOCKS" != "no"; then + AC_CHECK_LIB(uuid, uuid_unparse, [ + AC_CHECK_HEADERS([uuid/uuid.h],[ + UUID_LIBS=-luuid + AC_DEFINE([HAVE_UUID], [1], [libuuid]) + AC_DEFINE([HAVE_UUID_H], [1], [uuid/uuid.h is available]) + ]) + ]) + + fi fi +AC_SUBST(UUID_LIBS) dnl Check for gdbm AC_MSG_CHECKING(for gdbm) @@ -373,7 +390,7 @@ if test "$WITH_MEMCACHE" != "no"; then ]) AC_SUBST(MEMCACHE_LIB) fi - + dnl Check for lua AC_MSG_CHECKING(if lua-support is requested) AC_ARG_WITH(lua, AC_HELP_STRING([--with-lua],[lua engine for mod_cml]), @@ -381,30 +398,13 @@ AC_ARG_WITH(lua, AC_HELP_STRING([--with-lua],[lua engine for mod_cml]), AC_MSG_RESULT($WITH_LUA) if test "$WITH_LUA" != "no"; then - AC_PATH_PROG(LUACONFIG, lua-config) - - if test x"$LUACONFIG" != x; then - LUA_CFLAGS=`$LUACONFIG --include` - LUA_LIBS=`$LUACONFIG --libs --extralibs` + if test "$WITH_LUA" == "yes"; then + WITH_LUA=lua + fi + PKG_CHECK_MODULES(LUA, $WITH_LUA >= 5.1, [ AC_DEFINE([HAVE_LUA], [1], [liblua]) AC_DEFINE([HAVE_LUA_H], [1], [lua.h]) - else - AC_CHECK_LIB(lua, lua_open, [ - AC_CHECK_HEADERS([lua.h],[ - LUA_LIBS="-llua -llualib" - AC_DEFINE([HAVE_LUA], [1], [liblua]) - AC_DEFINE([HAVE_LUA_H], [1], [lua.h]) - ]) - ]) - fi - - if test x"$LUA_LIBS" = x; then - # try pkgconfig - PKG_CHECK_MODULES(LUA, lua >= 5.0, [ - AC_DEFINE([HAVE_LUA], [1], [liblua]) - AC_DEFINE([HAVE_LUA_H], [1], [lua.h]) - ]) - fi + ]) AC_SUBST(LUA_CFLAGS) AC_SUBST(LUA_LIBS) @@ -472,13 +472,13 @@ if test "x$ac_cv_func_sendfile" = xyes; then int o = 0; if (-1 == sendfile(-1, 0, &o, 0) && errno == ENOSYS) return -1; return 0; - } ], - AC_MSG_RESULT(yes), - [ AC_MSG_RESULT(no) + } ], + AC_MSG_RESULT(yes), + [ AC_MSG_RESULT(no) AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile]) ] ) else - AC_MSG_RESULT(no, cross-compiling) - AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile]) + AC_MSG_RESULT(no, cross-compiling) + AC_DEFINE([HAVE_SENDFILE_BROKEN], [1], [broken sendfile]) fi fi @@ -498,7 +498,7 @@ if test x$ipv6 = xtrue; then #include #include ], [struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0; ], [ac_cv_ipv6_support=yes], [ac_cv_ipv6_support=no])]) - + if test "$ac_cv_ipv6_support" = yes; then AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support]) fi @@ -510,7 +510,7 @@ AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = xyes) dnl check for fastcgi lib, for the tests only fastcgi_found=no AC_CHECK_LIB(fcgi, FCGI_Accept, [ - AC_CHECK_HEADERS([fastcgi.h],[ + AC_CHECK_HEADERS([fastcgi.h fastcgi/fastcgi.h],[ fastcgi_found=yes ]) ]) @@ -519,12 +519,12 @@ AM_CONDITIONAL(CHECK_WITH_FASTCGI, test "x$fastcgi_found" = xyes) if test "${GCC}" = "yes"; then - CFLAGS="${CFLAGS} -Wall -W -Wshadow -pedantic" + CFLAGS="${CFLAGS} -Wall -W -Wshadow -pedantic -std=gnu99" fi dnl build version-id LIGHTTPD_VERSION_ID=`echo $PACKAGE_VERSION | $AWK -F '.' '{print "(" $1 " << 16 | " $2 " << 8 | " $3 ")"}'` -AC_DEFINE_UNQUOTED([LIGHTTPD_VERSION_ID], [$LIGHTTPD_VERSION_ID], [lighttpd-version-id]) +AC_DEFINE_UNQUOTED([LIGHTTPD_VERSION_ID], [$LIGHTTPD_VERSION_ID], [lighttpd-version-id]) AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile tests/Makefile \ tests/docroot/Makefile \ @@ -538,7 +538,7 @@ AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile tests/Makefile \ AC_OUTPUT -do_build="mod_cgi mod_fastcgi mod_proxy mod_evhost mod_simple_vhost mod_access mod_alias mod_setenv mod_usertrack mod_auth mod_status mod_accesslog mod_rrdtool mod_secdownload mod_expire mod_compress mod_dirlisting mod_indexfiles mod_userdir mod_webdav mod_staticfile mod_scgi mod_flv_streaming" +do_build="mod_cgi mod_fastcgi mod_proxy mod_evhost mod_simple_vhost mod_access mod_alias mod_setenv mod_usertrack mod_auth mod_status mod_accesslog mod_rrdtool mod_secdownload mod_expire mod_compress mod_dirlisting mod_indexfiles mod_userdir mod_webdav mod_staticfile mod_scgi mod_flv_streaming" plugins="mod_rewrite mod_redirect mod_ssi mod_trigger_b4_dl" features="regex-conditionals" @@ -642,6 +642,14 @@ else disable_feature="$disable_feature $features" fi +features="webdav-locks" +if test "x$UUID_LIBS" \!= x; then + enable_feature="$enable_feature $features" +else + disable_feature="$disable_feature $features" +fi + + ## output $ECHO diff --git a/cygwin/Makefile.in b/cygwin/Makefile.in index 68007f9..ba0c88c 100644 --- a/cygwin/Makefile.in +++ b/cygwin/Makefile.in @@ -101,7 +101,6 @@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ -LUACONFIG = @LUACONFIG@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LIBS = @LUA_LIBS@ MAINT = @MAINT@ @@ -134,6 +133,7 @@ SQLITE_LIBS = @SQLITE_LIBS@ SSL_LIB = @SSL_LIB@ STRIP = @STRIP@ U = @U@ +UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CFLAGS = @XML_CFLAGS@ XML_LIBS = @XML_LIBS@ diff --git a/cygwin/lighttpd.README b/cygwin/lighttpd.README index 2454c27..9a06680 100644 --- a/cygwin/lighttpd.README +++ b/cygwin/lighttpd.README @@ -1,114 +1,114 @@ -lighttpd ------------------------------------------- -A fast, secure and flexible webserver - -Runtime requirements: - cygwin-1.5.10 or newer - crypt-1.1 or newer - libbz2_1-1.0.2 or newer - libpcre0-4.5 or newer - openssl-0.9.7d or newer - zlib-1.2.1 or newer - -Build requirements: - cygwin-1.5.10 or newer - gcc-3.3.1-3 or newer - binutils-20030901-1 or newer - crypt - openssl-devel - openssl - openldap - openldap-devel - zlib - bzip2 - -Canonical homepage: - http://jan.kneschke.de/projects/lighttpd/ - -Canonical download: - http://jan.kneschke.de/projects/lighttpd/download - ------------------------------------- - -Build instructions: - unpack lighttpd-1.4.12--src.tar.bz2 - if you use setup to install this src package, it will be - unpacked under /usr/src automatically - cd /usr/src - ./lighttpd-1.4.12-.sh all - -This will create: - /usr/src/lighttpd-1.4.12-.tar.bz2 - /usr/src/lighttpd-1.4.12--src.tar.bz2 - -Or use './lighttpd-1.4.12-.sh prep' to get a patched source directory - -------------------------------------------- - -Files included in the binary distribution: - - /etc/lighttpd/lighttpd.conf.default - /usr/lib/cyglightcomp.dll - /usr/lib/lighttpd/mod_access.dll - /usr/lib/lighttpd/mod_accesslog.dll - /usr/lib/lighttpd/mod_auth.dll - /usr/lib/lighttpd/mod_cgi.dll - /usr/lib/lighttpd/mod_compress.dll - /usr/lib/lighttpd/mod_evhost.dll - /usr/lib/lighttpd/mod_expire.dll - /usr/lib/lighttpd/mod_fastcgi.dll - /usr/lib/lighttpd/mod_httptls.dll - /usr/lib/lighttpd/mod_maps.dll - /usr/lib/lighttpd/mod_proxy.dll - /usr/lib/lighttpd/mod_redirect.dll - /usr/lib/lighttpd/mod_rewrite.dll - /usr/lib/lighttpd/mod_rrdtool.dll - /usr/lib/lighttpd/mod_secdownload.dll - /usr/lib/lighttpd/mod_simple_vhost.dll - /usr/lib/lighttpd/mod_ssi.dll - /usr/lib/lighttpd/mod_status.dll - /usr/lib/lighttpd/mod_usertrack.dll - /usr/sbin/lighttpd.exe - /usr/share/doc/Cygwin/lighttpd-1.3.0.README - /usr/share/doc/lighttpd-1.3.0/accesslog.txt - /usr/share/doc/lighttpd-1.3.0/authentification.txt - /usr/share/doc/lighttpd-1.3.0/AUTHORS - /usr/share/doc/lighttpd-1.3.0/cgi.txt - /usr/share/doc/lighttpd-1.3.0/ChangeLog - /usr/share/doc/lighttpd-1.3.0/compress.txt - /usr/share/doc/lighttpd-1.3.0/configuration.txt - /usr/share/doc/lighttpd-1.3.0/COPYING - /usr/share/doc/lighttpd-1.3.0/fastcgi-state.txt - /usr/share/doc/lighttpd-1.3.0/fastcgi.txt - /usr/share/doc/lighttpd-1.3.0/features.txt - /usr/share/doc/lighttpd-1.3.0/INSTALL - /usr/share/doc/lighttpd-1.3.0/NEWS - /usr/share/doc/lighttpd-1.3.0/performance.txt - /usr/share/doc/lighttpd-1.3.0/plugins.txt - /usr/share/doc/lighttpd-1.3.0/proxy.txt - /usr/share/doc/lighttpd-1.3.0/README - /usr/share/doc/lighttpd-1.3.0/redirect.txt - /usr/share/doc/lighttpd-1.3.0/rewrite.txt - /usr/share/doc/lighttpd-1.3.0/rrdtool.txt - /usr/share/doc/lighttpd-1.3.0/secdownload.txt - /usr/share/doc/lighttpd-1.3.0/security.txt - /usr/share/doc/lighttpd-1.3.0/simple-vhost.txt - /usr/share/doc/lighttpd-1.3.0/skeleton.txt - /usr/share/doc/lighttpd-1.3.0/ssi.txt - /usr/share/doc/lighttpd-1.3.0/state.txt - /usr/share/man/man1/lighttpd.1.gz - ------------------- - -Port Notes: - ----------- lighttpd-1.3.1-1 ----------- - -Updated to 1.3.1 - ----------- lighttpd-1.3.0-1 ----------- -Initial release - -Cygwin port maintained by: Jan Kneschke -Please address all questions to the Cygwin mailing list at - +lighttpd +------------------------------------------ +A fast, secure and flexible webserver + +Runtime requirements: + cygwin-1.5.10 or newer + crypt-1.1 or newer + libbz2_1-1.0.2 or newer + libpcre0-4.5 or newer + openssl-0.9.7d or newer + zlib-1.2.1 or newer + +Build requirements: + cygwin-1.5.10 or newer + gcc-3.3.1-3 or newer + binutils-20030901-1 or newer + crypt + openssl-devel + openssl + openldap + openldap-devel + zlib + bzip2 + +Canonical homepage: + http://jan.kneschke.de/projects/lighttpd/ + +Canonical download: + http://jan.kneschke.de/projects/lighttpd/download + +------------------------------------ + +Build instructions: + unpack lighttpd-1.4.13--src.tar.bz2 + if you use setup to install this src package, it will be + unpacked under /usr/src automatically + cd /usr/src + ./lighttpd-1.4.13-.sh all + +This will create: + /usr/src/lighttpd-1.4.13-.tar.bz2 + /usr/src/lighttpd-1.4.13--src.tar.bz2 + +Or use './lighttpd-1.4.13-.sh prep' to get a patched source directory + +------------------------------------------- + +Files included in the binary distribution: + + /etc/lighttpd/lighttpd.conf.default + /usr/lib/cyglightcomp.dll + /usr/lib/lighttpd/mod_access.dll + /usr/lib/lighttpd/mod_accesslog.dll + /usr/lib/lighttpd/mod_auth.dll + /usr/lib/lighttpd/mod_cgi.dll + /usr/lib/lighttpd/mod_compress.dll + /usr/lib/lighttpd/mod_evhost.dll + /usr/lib/lighttpd/mod_expire.dll + /usr/lib/lighttpd/mod_fastcgi.dll + /usr/lib/lighttpd/mod_httptls.dll + /usr/lib/lighttpd/mod_maps.dll + /usr/lib/lighttpd/mod_proxy.dll + /usr/lib/lighttpd/mod_redirect.dll + /usr/lib/lighttpd/mod_rewrite.dll + /usr/lib/lighttpd/mod_rrdtool.dll + /usr/lib/lighttpd/mod_secdownload.dll + /usr/lib/lighttpd/mod_simple_vhost.dll + /usr/lib/lighttpd/mod_ssi.dll + /usr/lib/lighttpd/mod_status.dll + /usr/lib/lighttpd/mod_usertrack.dll + /usr/sbin/lighttpd.exe + /usr/share/doc/Cygwin/lighttpd-1.3.0.README + /usr/share/doc/lighttpd-1.3.0/accesslog.txt + /usr/share/doc/lighttpd-1.3.0/authentification.txt + /usr/share/doc/lighttpd-1.3.0/AUTHORS + /usr/share/doc/lighttpd-1.3.0/cgi.txt + /usr/share/doc/lighttpd-1.3.0/ChangeLog + /usr/share/doc/lighttpd-1.3.0/compress.txt + /usr/share/doc/lighttpd-1.3.0/configuration.txt + /usr/share/doc/lighttpd-1.3.0/COPYING + /usr/share/doc/lighttpd-1.3.0/fastcgi-state.txt + /usr/share/doc/lighttpd-1.3.0/fastcgi.txt + /usr/share/doc/lighttpd-1.3.0/features.txt + /usr/share/doc/lighttpd-1.3.0/INSTALL + /usr/share/doc/lighttpd-1.3.0/NEWS + /usr/share/doc/lighttpd-1.3.0/performance.txt + /usr/share/doc/lighttpd-1.3.0/plugins.txt + /usr/share/doc/lighttpd-1.3.0/proxy.txt + /usr/share/doc/lighttpd-1.3.0/README + /usr/share/doc/lighttpd-1.3.0/redirect.txt + /usr/share/doc/lighttpd-1.3.0/rewrite.txt + /usr/share/doc/lighttpd-1.3.0/rrdtool.txt + /usr/share/doc/lighttpd-1.3.0/secdownload.txt + /usr/share/doc/lighttpd-1.3.0/security.txt + /usr/share/doc/lighttpd-1.3.0/simple-vhost.txt + /usr/share/doc/lighttpd-1.3.0/skeleton.txt + /usr/share/doc/lighttpd-1.3.0/ssi.txt + /usr/share/doc/lighttpd-1.3.0/state.txt + /usr/share/man/man1/lighttpd.1.gz + +------------------ + +Port Notes: + +---------- lighttpd-1.3.1-1 ----------- + +Updated to 1.3.1 + +---------- lighttpd-1.3.0-1 ----------- +Initial release + +Cygwin port maintained by: Jan Kneschke +Please address all questions to the Cygwin mailing list at + diff --git a/cygwin/lighttpd.README.in b/cygwin/lighttpd.README.in index 2b45546..d4910e4 100644 --- a/cygwin/lighttpd.README.in +++ b/cygwin/lighttpd.README.in @@ -1,114 +1,114 @@ -lighttpd ------------------------------------------- -A fast, secure and flexible webserver - -Runtime requirements: - cygwin-1.5.10 or newer - crypt-1.1 or newer - libbz2_1-1.0.2 or newer - libpcre0-4.5 or newer - openssl-0.9.7d or newer - zlib-1.2.1 or newer - -Build requirements: - cygwin-1.5.10 or newer - gcc-3.3.1-3 or newer - binutils-20030901-1 or newer - crypt - openssl-devel - openssl - openldap - openldap-devel - zlib - bzip2 - -Canonical homepage: - http://jan.kneschke.de/projects/lighttpd/ - -Canonical download: - http://jan.kneschke.de/projects/lighttpd/download - ------------------------------------- - -Build instructions: - unpack lighttpd-@VERSION@--src.tar.bz2 - if you use setup to install this src package, it will be - unpacked under /usr/src automatically - cd /usr/src - ./lighttpd-@VERSION@-.sh all - -This will create: - /usr/src/lighttpd-@VERSION@-.tar.bz2 - /usr/src/lighttpd-@VERSION@--src.tar.bz2 - -Or use './lighttpd-@VERSION@-.sh prep' to get a patched source directory - -------------------------------------------- - -Files included in the binary distribution: - - /etc/lighttpd/lighttpd.conf.default - /usr/lib/cyglightcomp.dll - /usr/lib/lighttpd/mod_access.dll - /usr/lib/lighttpd/mod_accesslog.dll - /usr/lib/lighttpd/mod_auth.dll - /usr/lib/lighttpd/mod_cgi.dll - /usr/lib/lighttpd/mod_compress.dll - /usr/lib/lighttpd/mod_evhost.dll - /usr/lib/lighttpd/mod_expire.dll - /usr/lib/lighttpd/mod_fastcgi.dll - /usr/lib/lighttpd/mod_httptls.dll - /usr/lib/lighttpd/mod_maps.dll - /usr/lib/lighttpd/mod_proxy.dll - /usr/lib/lighttpd/mod_redirect.dll - /usr/lib/lighttpd/mod_rewrite.dll - /usr/lib/lighttpd/mod_rrdtool.dll - /usr/lib/lighttpd/mod_secdownload.dll - /usr/lib/lighttpd/mod_simple_vhost.dll - /usr/lib/lighttpd/mod_ssi.dll - /usr/lib/lighttpd/mod_status.dll - /usr/lib/lighttpd/mod_usertrack.dll - /usr/sbin/lighttpd.exe - /usr/share/doc/Cygwin/lighttpd-1.3.0.README - /usr/share/doc/lighttpd-1.3.0/accesslog.txt - /usr/share/doc/lighttpd-1.3.0/authentification.txt - /usr/share/doc/lighttpd-1.3.0/AUTHORS - /usr/share/doc/lighttpd-1.3.0/cgi.txt - /usr/share/doc/lighttpd-1.3.0/ChangeLog - /usr/share/doc/lighttpd-1.3.0/compress.txt - /usr/share/doc/lighttpd-1.3.0/configuration.txt - /usr/share/doc/lighttpd-1.3.0/COPYING - /usr/share/doc/lighttpd-1.3.0/fastcgi-state.txt - /usr/share/doc/lighttpd-1.3.0/fastcgi.txt - /usr/share/doc/lighttpd-1.3.0/features.txt - /usr/share/doc/lighttpd-1.3.0/INSTALL - /usr/share/doc/lighttpd-1.3.0/NEWS - /usr/share/doc/lighttpd-1.3.0/performance.txt - /usr/share/doc/lighttpd-1.3.0/plugins.txt - /usr/share/doc/lighttpd-1.3.0/proxy.txt - /usr/share/doc/lighttpd-1.3.0/README - /usr/share/doc/lighttpd-1.3.0/redirect.txt - /usr/share/doc/lighttpd-1.3.0/rewrite.txt - /usr/share/doc/lighttpd-1.3.0/rrdtool.txt - /usr/share/doc/lighttpd-1.3.0/secdownload.txt - /usr/share/doc/lighttpd-1.3.0/security.txt - /usr/share/doc/lighttpd-1.3.0/simple-vhost.txt - /usr/share/doc/lighttpd-1.3.0/skeleton.txt - /usr/share/doc/lighttpd-1.3.0/ssi.txt - /usr/share/doc/lighttpd-1.3.0/state.txt - /usr/share/man/man1/lighttpd.1.gz - ------------------- - -Port Notes: - ----------- lighttpd-1.3.1-1 ----------- - -Updated to 1.3.1 - ----------- lighttpd-1.3.0-1 ----------- -Initial release - -Cygwin port maintained by: Jan Kneschke -Please address all questions to the Cygwin mailing list at - +lighttpd +------------------------------------------ +A fast, secure and flexible webserver + +Runtime requirements: + cygwin-1.5.10 or newer + crypt-1.1 or newer + libbz2_1-1.0.2 or newer + libpcre0-4.5 or newer + openssl-0.9.7d or newer + zlib-1.2.1 or newer + +Build requirements: + cygwin-1.5.10 or newer + gcc-3.3.1-3 or newer + binutils-20030901-1 or newer + crypt + openssl-devel + openssl + openldap + openldap-devel + zlib + bzip2 + +Canonical homepage: + http://jan.kneschke.de/projects/lighttpd/ + +Canonical download: + http://jan.kneschke.de/projects/lighttpd/download + +------------------------------------ + +Build instructions: + unpack lighttpd-@VERSION@--src.tar.bz2 + if you use setup to install this src package, it will be + unpacked under /usr/src automatically + cd /usr/src + ./lighttpd-@VERSION@-.sh all + +This will create: + /usr/src/lighttpd-@VERSION@-.tar.bz2 + /usr/src/lighttpd-@VERSION@--src.tar.bz2 + +Or use './lighttpd-@VERSION@-.sh prep' to get a patched source directory + +------------------------------------------- + +Files included in the binary distribution: + + /etc/lighttpd/lighttpd.conf.default + /usr/lib/cyglightcomp.dll + /usr/lib/lighttpd/mod_access.dll + /usr/lib/lighttpd/mod_accesslog.dll + /usr/lib/lighttpd/mod_auth.dll + /usr/lib/lighttpd/mod_cgi.dll + /usr/lib/lighttpd/mod_compress.dll + /usr/lib/lighttpd/mod_evhost.dll + /usr/lib/lighttpd/mod_expire.dll + /usr/lib/lighttpd/mod_fastcgi.dll + /usr/lib/lighttpd/mod_httptls.dll + /usr/lib/lighttpd/mod_maps.dll + /usr/lib/lighttpd/mod_proxy.dll + /usr/lib/lighttpd/mod_redirect.dll + /usr/lib/lighttpd/mod_rewrite.dll + /usr/lib/lighttpd/mod_rrdtool.dll + /usr/lib/lighttpd/mod_secdownload.dll + /usr/lib/lighttpd/mod_simple_vhost.dll + /usr/lib/lighttpd/mod_ssi.dll + /usr/lib/lighttpd/mod_status.dll + /usr/lib/lighttpd/mod_usertrack.dll + /usr/sbin/lighttpd.exe + /usr/share/doc/Cygwin/lighttpd-1.3.0.README + /usr/share/doc/lighttpd-1.3.0/accesslog.txt + /usr/share/doc/lighttpd-1.3.0/authentification.txt + /usr/share/doc/lighttpd-1.3.0/AUTHORS + /usr/share/doc/lighttpd-1.3.0/cgi.txt + /usr/share/doc/lighttpd-1.3.0/ChangeLog + /usr/share/doc/lighttpd-1.3.0/compress.txt + /usr/share/doc/lighttpd-1.3.0/configuration.txt + /usr/share/doc/lighttpd-1.3.0/COPYING + /usr/share/doc/lighttpd-1.3.0/fastcgi-state.txt + /usr/share/doc/lighttpd-1.3.0/fastcgi.txt + /usr/share/doc/lighttpd-1.3.0/features.txt + /usr/share/doc/lighttpd-1.3.0/INSTALL + /usr/share/doc/lighttpd-1.3.0/NEWS + /usr/share/doc/lighttpd-1.3.0/performance.txt + /usr/share/doc/lighttpd-1.3.0/plugins.txt + /usr/share/doc/lighttpd-1.3.0/proxy.txt + /usr/share/doc/lighttpd-1.3.0/README + /usr/share/doc/lighttpd-1.3.0/redirect.txt + /usr/share/doc/lighttpd-1.3.0/rewrite.txt + /usr/share/doc/lighttpd-1.3.0/rrdtool.txt + /usr/share/doc/lighttpd-1.3.0/secdownload.txt + /usr/share/doc/lighttpd-1.3.0/security.txt + /usr/share/doc/lighttpd-1.3.0/simple-vhost.txt + /usr/share/doc/lighttpd-1.3.0/skeleton.txt + /usr/share/doc/lighttpd-1.3.0/ssi.txt + /usr/share/doc/lighttpd-1.3.0/state.txt + /usr/share/man/man1/lighttpd.1.gz + +------------------ + +Port Notes: + +---------- lighttpd-1.3.1-1 ----------- + +Updated to 1.3.1 + +---------- lighttpd-1.3.0-1 ----------- +Initial release + +Cygwin port maintained by: Jan Kneschke +Please address all questions to the Cygwin mailing list at + diff --git a/distribute.sh.in b/distribute.sh.in index e0b63a3..a85fcec 100644 --- a/distribute.sh.in +++ b/distribute.sh.in @@ -3,7 +3,7 @@ PACKAGE=@PACKAGE_TARNAME@ VERSION=@VERSION@ NAME=@PACKAGE_TARNAME@-@VERSION@ -DISTDIR="/home/jan/wwwroot/servers/www.lighttpd.net/pages/download/" +DISTDIR="/home/jan/wwwroot/servers/www.lighttpd.net/pages/download/" RPMS="/home/jan/rpmbuild/RPMS/i386/${NAME}-1.i386.rpm \ /home/jan/rpmbuild/SRPMS/${NAME}-1.src.rpm" FILES="${RPMS} ${NAME}.tar.gz \ @@ -21,7 +21,7 @@ esac echo ${nopack} if test x${pack} = x1; then - make distcheck && rpmbuild -ta --nodeps ${NAME}.tar.gz + make distcheck && rpmbuild -ta --nodeps ${NAME}.tar.gz gpg --detach-sign ${NAME}.tar.gz rpm --addsign ${RPMS} fi @@ -49,7 +49,7 @@ Download MD5: ${MD5SRPM} - ${NAME}.tar.gz ${DLNAME}.tar.gz - MD5: ${MD5TGZ} + MD5: ${MD5TGZ} Signature: ${DLNAME}.tar.gz.sig EOF @@ -67,7 +67,7 @@ Checksums - ${NAME}-1.src.rpm MD5: ${MD5SRPM} - ${NAME}.tar.gz - MD5: ${MD5TGZ} + MD5: ${MD5TGZ} EOF diff --git a/doc/Makefile.am b/doc/Makefile.am index 47ca576..792ff22 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -35,7 +35,8 @@ trigger_b4_dl.txt \ webdav.txt \ expire.txt \ dirlisting.txt \ -evhost.txt +evhost.txt \ +magnet.txt HTMLDOCS=accesslog.html \ authentication.html \ @@ -71,7 +72,8 @@ HTMLDOCS=accesslog.html \ webdav.html \ expire.html \ dirlisting.html \ - evhost.html + evhost.html \ + magnet.html EXTRA_DIST=lighttpd.conf lighttpd.user \ rc.lighttpd rc.lighttpd.redhat sysconfig.lighttpd \ @@ -81,7 +83,7 @@ EXTRA_DIST=lighttpd.conf lighttpd.user \ newstyle.css \ oldstyle.css \ $(DOCS) - + %.html: %.txt rst2html $^ > $@ @@ -90,11 +92,11 @@ html: $(HTMLDOCS) #%.ps.gz: %.ps # gzip $^ - + #%.ps: %.dot -# dot -Tps -o $@ $^ +# dot -Tps -o $@ $^ clean-local: rm -f *.html - + diff --git a/doc/Makefile.in b/doc/Makefile.in index b133b09..e177fed 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -105,7 +105,6 @@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ -LUACONFIG = @LUACONFIG@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LIBS = @LUA_LIBS@ MAINT = @MAINT@ @@ -138,6 +137,7 @@ SQLITE_LIBS = @SQLITE_LIBS@ SSL_LIB = @SSL_LIB@ STRIP = @STRIP@ U = @U@ +UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CFLAGS = @XML_CFLAGS@ XML_LIBS = @XML_LIBS@ @@ -225,7 +225,8 @@ trigger_b4_dl.txt \ webdav.txt \ expire.txt \ dirlisting.txt \ -evhost.txt +evhost.txt \ +magnet.txt HTMLDOCS = accesslog.html \ authentication.html \ @@ -261,7 +262,8 @@ HTMLDOCS = accesslog.html \ webdav.html \ expire.html \ dirlisting.html \ - evhost.html + evhost.html \ + magnet.html EXTRA_DIST = lighttpd.conf lighttpd.user \ rc.lighttpd rc.lighttpd.redhat sysconfig.lighttpd \ @@ -491,7 +493,7 @@ html: $(HTMLDOCS) # gzip $^ #%.ps: %.dot -# dot -Tps -o $@ $^ +# dot -Tps -o $@ $^ clean-local: rm -f *.html diff --git a/doc/access.txt b/doc/access.txt index acfdcb7..042da01 100644 --- a/doc/access.txt +++ b/doc/access.txt @@ -12,10 +12,10 @@ Module: mod_access :abstract: The access module is used to deny access to files with given trailing path names. - + .. meta:: :keywords: lighttpd, trailing path access control - + .. contents:: Table of Contents Description @@ -32,7 +32,7 @@ url.access-deny Default: empty Example: :: - + url.access-deny = ( "~", ".inc") will deny access to all files ended with a diacritical mark (~) or .inc diff --git a/doc/accesslog.txt b/doc/accesslog.txt index 36584cf..889a4da 100644 --- a/doc/accesslog.txt +++ b/doc/accesslog.txt @@ -11,11 +11,11 @@ Module: mod_accesslog :Revision: $Revision: 1.2 $ :abstract: - The accesslog module ... - + The accesslog module ... + .. meta:: :keywords: lighttpd, accesslog, CLF - + .. contents:: Table of Contents Description @@ -28,30 +28,30 @@ Options accesslog.use-syslog send the accesslog to syslog - + Default: disabled accesslog.filename name of the file where the accesslog should be written too if syslog is not used. - + if the name starts with a '|' the rest of the name is taken as the name of a process which will be spawn and will get the output - + e.g.: :: - + accesslog.filename = "/var/log/lighttpd.log" - + $HTTP["host"] == "mail.example.org" { accesslog.filename = "|/usr/bin/cronolog" } - + Default: disabled accesslog.format the format of the logfile - + ====== ================================ Option Description ====== ================================ @@ -60,8 +60,8 @@ accesslog.format %l ident name (not supported) %u authenticated user %t timestamp for the request-start - %r request-line - %s status code + %r request-line + %s status code %b bytes sent for the body %i HTTP-header field %a remote address @@ -86,16 +86,16 @@ accesslog.format %I bytes incomming %O bytes outgoing ====== ================================ - + If %s is written %>s or % are ignored. They are support - for compat with apache. - + for compat with apache. + %i and %o expect the name of the field which should be written in curly brackets. - + e.g.: :: - + accesslog.format = "%h %l %u %t \"%r\" %b %>s \"%{User-Agent}i\" \"%{Referer}i\"" - + Default: CLF compatible output Response Header @@ -109,18 +109,18 @@ If you want to log it into the accesslog just specify the field-name within a %{...}o like :: accesslog.format = "%h %l %u %t \"%r\" %b %>s \"%{User-Agent}i\" \"%{Referer}i\" \"%{X-LIGHTTPD-SID}o\"" - + The prefix ``X-LIGHTTPD-`` is special as every response header starting with this prefix is assumed to be special for lighttpd and won't be sent out -to the client. +to the client. An example the use this functionality is provided below: :: diff --git a/doc/alias.txt b/doc/alias.txt index 15012e3..1315f93 100644 --- a/doc/alias.txt +++ b/doc/alias.txt @@ -11,11 +11,11 @@ Module: mod_alias :Revision: $Revision: 1.1 $ :abstract: - The alias module ... - + The alias module ... + .. meta:: :keywords: lighttpd, alias - + .. contents:: Table of Contents Description @@ -32,5 +32,5 @@ alias.url Default: empty Example: :: - + alias.url = ( "/cgi-bin/" => "/var/www/servers/www.example.org/cgi-bin/" ) diff --git a/doc/authentication.txt b/doc/authentication.txt index 2a11f64..c375ece 100644 --- a/doc/authentication.txt +++ b/doc/authentication.txt @@ -7,15 +7,15 @@ Module: mod_auth ---------------- :Author: Jan Kneschke -:Date: $Date: 2006-01-12 19:34:26 +0100 (Thu, 12 Jan 2006) $ -:Revision: $Revision: 940 $ +:Date: $Date: 2006-10-04 15:26:23 +0200 (Wed, 04 Oct 2006) $ +:Revision: $Revision: 1371 $ :abstract: The auth module provides ... - + .. meta:: :keywords: lighttpd, authentication - + .. contents:: Table of Contents Description @@ -24,85 +24,85 @@ Description Supported Methods ----------------- -lighttpd supportes both authentication method described by -RFC 2617: +lighttpd supportes both authentication method described by +RFC 2617: basic ````` -The Basic method transfers the username and the password in -cleartext over the network (base64 encoded) and might result -in security problems if not used in conjunction with a crypted +The Basic method transfers the username and the password in +cleartext over the network (base64 encoded) and might result +in security problems if not used in conjunction with a crypted channel between client and server. digest `````` -The Digest method only transfers a hashed value over the -network which performs a lot of work to harden the +The Digest method only transfers a hashed value over the +network which performs a lot of work to harden the authentication process in insecure networks. Backends -------- -Depending on the method lighttpd provides various way to store +Depending on the method lighttpd provides various way to store the credentials used for the authentication. for basic auth: - plain_ -- htpasswd_ +- htpasswd_ - htdigest_ - ldap_ - + for digest auth: - plain_ - htdigest_ - + plain ````` -A file which contains username and the cleartext password -seperated by a colon. Each entry is terminated by a single +A file which contains username and the cleartext password +seperated by a colon. Each entry is terminated by a single newline.:: e.g.: agent007:secret - + htpasswd ```````` -A file which contains username and the crypt()'ed password -seperated by a colon. Each entry is terminated by a single +A file which contains username and the crypt()'ed password +seperated by a colon. Each entry is terminated by a single newline. :: e.g.: agent007:XWY5JwrAVBXsQ -You can use htpasswd from the apache distribution to manage +You can use htpasswd from the apache distribution to manage those files. :: - + $ htpasswd lighttpd.user.htpasswd agent007 - - + + htdigest ```````` -A file which contains username, realm and the md5()'ed -password seperated by a colon. Each entry is terminated +A file which contains username, realm and the md5()'ed +password seperated by a colon. Each entry is terminated by a single newline. :: - + e.g.: agent007:download area:8364d0044ef57b3defcfa141e8f77b65 - -You can use htdigest from the apache distribution to manage + +You can use htdigest from the apache distribution to manage those files. :: $ htdigest lighttpd.user.htdigest 'download area' agent007 - + Using md5sum can also generate the password-hash: :: #!/bin/sh @@ -118,21 +118,21 @@ To use it: $ htdigest.sh 'agent007' 'download area' 'secret' agent007:download area:8364d0044ef57b3defcfa141e8f77b65 - - - + + + ldap ```` -the ldap backend is basically performing the following steps +the ldap backend is basically performing the following steps to authenticate a user - + 1. connect anonymously (at plugin init) 2. get DN for filter = username 3. auth against ldap server 4. disconnect - -if all 4 steps are performed without any error the user is + +if all 4 steps are performed without any error the user is authenticated Configuration @@ -143,28 +143,28 @@ Configuration ## debugging # 0 for off, 1 for 'auth-ok' messages, 2 for verbose debugging auth.debug = 0 - - ## type of backend + + ## type of backend # plain, htpasswd, ldap or htdigest auth.backend = "htpasswd" - # filename of the password storage for + # filename of the password storage for # plain auth.backend.plain.userfile = "lighttpd-plain.user" - + ## for htpasswd auth.backend.htpasswd.userfile = "lighttpd-htpasswd.user" - + ## for htdigest auth.backend.htdigest.userfile = "lighttpd-htdigest.user" ## for ldap - # the $ in auth.backend.ldap.filter is replaced by the + # the $ in auth.backend.ldap.filter is replaced by the # 'username' from the login dialog auth.backend.ldap.hostname = "localhost" auth.backend.ldap.base-dn = "dc=my-domain,dc=com" auth.backend.ldap.filter = "(uid=$)" - # if enabled, startTLS needs a valid (base64-encoded) CA + # if enabled, startTLS needs a valid (base64-encoded) CA # certificate auth.backend.ldap.starttls = "enable" auth.backend.ldap.ca-file = "/etc/CAcertificate.pem" @@ -178,20 +178,20 @@ Configuration # "require" => "user=" ) # ) # - # is a string to display in the dialog - # presented to the user and is also used for the - # digest-algorithm and has to match the realm in the + # is a string to display in the dialog + # presented to the user and is also used for the + # digest-algorithm and has to match the realm in the # htdigest file (if used) # - auth.require = ( "/download/" => - ( + auth.require = ( "/download/" => + ( "method" => "digest", "realm" => "download archiv", "require" => "user=agent007|user=agent008" ), - "/server-info" => - ( + "/server-info" => + ( "method" => "digest", "realm" => "download archiv", "require" => "valid-user" @@ -201,7 +201,7 @@ Configuration Limitations ============ -- The implementation of digest method is currently not +- The implementation of digest method is currently not completely compliant with the standard as it still allows a replay attack. diff --git a/doc/cgi.txt b/doc/cgi.txt index 081d795..95d187c 100644 --- a/doc/cgi.txt +++ b/doc/cgi.txt @@ -12,10 +12,10 @@ Module: mod_cgi :abstract: The cgi module provides a CGI-conforming interface. - + .. meta:: :keywords: lighttpd, cgi - + .. contents:: Table of Contents Description @@ -32,7 +32,7 @@ cgi.assign file-extensions that are handled by a CGI program e.g.: :: - + cgi.assign = ( ".pl" => "/usr/bin/perl", ".cgi" => "/usr/bin/perl" ) @@ -43,7 +43,7 @@ To setup a executable which doesn't need the help of a external program you just don't specify a handler for the extension. :: cgi.assign = ( ".sh" => "" ) - + If the file has no extension keep in mind that lighttpd matches not the extension itself but the right part of the URL: :: diff --git a/doc/cml.txt b/doc/cml.txt index ae69067..10fac70 100644 --- a/doc/cml.txt +++ b/doc/cml.txt @@ -12,10 +12,10 @@ Module: mod_cml :abstract: CML is a Meta language to describe the dependencies of a page at one side and building a page from its fragments on the other side using LUA. - + .. meta:: :keywords: lighttpd, cml, lua - + .. contents:: Table of Contents Description @@ -31,7 +31,7 @@ CML (Cache Meta Language) wants to solves several problems: Cache Decision -------------- -A simple example should show how to a content caching the very simple way in PHP. +A simple example should show how to a content caching the very simple way in PHP. jan.kneschke.de has a very simple design: @@ -39,7 +39,7 @@ jan.kneschke.de has a very simple design: * the menu is generated from a menu.csv file * the content is coming from files on the local directory named content-1, content-2 and so on -The page content is static as long non of the those tree items changes. A change in the layout +The page content is static as long non of the those tree items changes. A change in the layout is affecting all pages, a change of menu.csv too, a change of content-x file only affects the cached page itself. @@ -58,7 +58,7 @@ If we model this in PHP we get: :: } foreach($content as $k => $v) { - if (isset($v["file"]) && + if (isset($v["file"]) && filemtime($v["file"]) > $cachemtime) { return 0; } @@ -71,7 +71,7 @@ If we model this in PHP we get: :: return 0; } } - + if (is_cachable(...), $cachefile) { readfile($cachefile); exit(); @@ -81,7 +81,7 @@ If we model this in PHP we get: :: ?> Quite simple. No magic involved. If the one of the files is new than the cached -content, the content is dirty and has to be regenerated. +content, the content is dirty and has to be regenerated. Now let take a look at the numbers: @@ -92,9 +92,9 @@ As you can see the increase is not as good as it could be. The main reason as th of the PHP interpreter to start up (a byte-code cache has been used here). Moving these decisions out of the PHP script into a server module will remove the need -to start PHP for a cache-hit. +to start PHP for a cache-hit. -To transform this example into a CML you need 'index.cml' in the list of indexfiles +To transform this example into a CML you need 'index.cml' in the list of indexfiles and the following index.cml file: :: output_contenttype = "text/html" @@ -110,7 +110,7 @@ and the following index.cml file: :: file_mtime(b .. "templates/jk.tmpl") > file_mtime(cwd .. "_cache.html") or file_mtime(b .. "content.html") > file_mtime(cwd .. "_cache.html") then return CACHE_MISS - else + else return CACHE_HIT end @@ -132,26 +132,26 @@ Sometimes the different fragment are already generated externally. You have to c readfile("spacer2.html"); readfile("news.html"); readfile("footer.html"); - ?> + ?> -We we can do the same several times faster directly in the webserver. +We we can do the same several times faster directly in the webserver. Don't forget: Webserver are built to send out static content, that is what they can do best. The index.cml for this looks like: :: output_contenttype = "text/html" - + cwd = request["CWD"] - - output_include = { cwd .. "head.html", + + output_include = { cwd .. "head.html", cwd .. "menu.html", cwd .. "spacer.html", cwd .. "db-content.html", cwd .. "spacer2.html", cwd .. "news.html", cwd .. "footer.html" } - + return CACHE_HIT Now we get about 10000 req/s instead of 600 req/s. @@ -161,7 +161,7 @@ Power Magnet Next to all the features about Cache Decisions CML can do more. Starting with lighttpd 1.4.9 a power-magnet was added which attracts each request -and allows you to manipulate the request for your needs. +and allows you to manipulate the request for your needs. We want to display a maintainance page by putting a file in a specified place: @@ -183,7 +183,7 @@ and create /home/www/power-magnet.cml with: :: For each requested file the /home/www/power-magnet.cml is executed which checks if maintainance.html exists in the docroot and displays it -instead of handling the usual request. +instead of handling the usual request. Another example, create thumbnail for requested image and serve it instead of sending the big image: :: @@ -196,7 +196,7 @@ of sending the big image: :: dr = request["DOCUMENT_ROOT"] sn = request["SCRIPT_NAME"] - ## to be continued :) ... + ## to be continued :) ... trigger_handler = '/gen_image.php' @@ -217,7 +217,7 @@ To use the plugin you have to load it: :: Options ======= -:cml.extension: +:cml.extension: the file extension that is bound to the cml-module :cml.memcache-hosts: hosts for the memcache.* functions @@ -229,7 +229,7 @@ Options Language ======== -The language used for CML is provided by `LUA `_. +The language used for CML is provided by `LUA `_. Additionally to the functions provided by lua mod_cml provides: :: @@ -252,10 +252,10 @@ Additionally to the functions provided by lua mod_cml provides: :: number file_mtime(string) string memcache_get_string(string) number memcache_get_long(string) - boolean memcache_exists(string) + boolean memcache_exists(string) -What ever your script does, it has to return either CACHE_HIT or CACHE_MISS. -It case a error occures check the error-log, the user will get a error 500. If you don't like +What ever your script does, it has to return either CACHE_HIT or CACHE_MISS. +It case a error occures check the error-log, the user will get a error 500. If you don't like the standard error-page use ``server.errorfile-prefix``. diff --git a/doc/compress.txt b/doc/compress.txt index 7b083e9..a739c42 100644 --- a/doc/compress.txt +++ b/doc/compress.txt @@ -12,17 +12,17 @@ Module: mod_compress :abstract: a nice, short abstrace about the module - + .. meta:: :keywords: lighttpd, compress - + .. contents:: Table of Contents Description =========== Output compression reduces the network load and can improve the overall -throughput of the webserver. +throughput of the webserver. Only static content is supported up to now. @@ -36,21 +36,21 @@ compress.cache-dir name of the directory where compressed content will be cached e.g.: :: - + compress.cache-dir = "/var/www/cache/" - + # even better with virt-hosting $HTTP["host"] == "docs.example.org" { compress.cache-dir = "/var/www/cache/docs.example.org/" } - + Default: not set, compress the file for every request compress.filetype mimetypes where might get compressed - + e.g.: :: - + compress.filetype = ("text/plain", "text/html") Default: not set @@ -62,5 +62,5 @@ Compressing Dynamic Content To compress dynamic content with PHP please enable :: zlib.output_compression = 1 - + in the php.ini as PHP provides compression support by itself. diff --git a/doc/configuration.txt b/doc/configuration.txt index 2b60e58..416329b 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -7,15 +7,15 @@ Module: core ------------ :Author: Jan Kneschke -:Date: $Date: 2006-03-09 01:10:40 +0100 (Thu, 09 Mar 2006) $ -:Revision: $Revision: 1034 $ +:Date: $Date: 2006-10-04 15:26:23 +0200 (Wed, 04 Oct 2006) $ +:Revision: $Revision: 1371 $ :abstract: the layout of the configuration file - + .. meta:: :keywords: lighttpd, configuration - + .. contents:: Table of Contents Description @@ -36,21 +36,21 @@ A BNF like notation: :: : "(" [ "=>" ] [, [ "=>" ] ]* ")" INCLUDE : "include" VALUE INCLUDE_SHELL : "include_shell" STRING_VALUE - + Example ------- :: - + # default document-root server.document-root = "/var/www/example.org/pages/" - + # TCP port server.port = 80 - + # selecting modules server.modules = ( "mod_access", "mod_rewrite" ) - + # variables, computed when config is read. var.mymodule = "foo" server.modules += ( "mod_" + var.mymodule ) @@ -125,22 +125,22 @@ Example $HTTP["url"] =~ "^/download/" { dir-listing.activate = "disable" } - + # handish virtual hosting # map all domains of a top-level-domain to a single document-root $HTTP["host"] =~ "(^|\.)example\.org$" { server.document-root = "/var/www/htdocs/example.org/pages/" } - + # multiple sockets $SERVER["socket"] == "127.0.0.1:81" { server.document-root = "..." } - + $SERVER["socket"] == "127.0.0.1:443" { ssl.pemfile = "/var/www/certs/localhost.pem" ssl.engine = "enable" - + server.document-root = "/var/www/htdocs/secure.example.org/pages/" } @@ -148,19 +148,19 @@ Example $HTTP["useragent"] =~ "Google" { url.access-deny = ( "" ) } - + # deny access for all image stealers $HTTP["referer"] !~ "^($|http://www\.example\.org)" { url.access-deny = ( ".jpg", ".jpeg", ".png" ) } - # deny the access to www.example.org to all user which + # deny the access to www.example.org to all user which # are not in the 10.0.0.0/8 network $HTTP["host"] == "www.example.org" { $HTTP["remoteip"] != "10.0.0.0/8" { url.access-deny = ( "" ) } - } + } Using variables =============== @@ -177,7 +177,7 @@ You can set your own variables in the configuration to simplify your config. in incl-base.conf: server.document-root = basedir + server.name + "/pages/" accesslog.filename = basedir + server.name + "/logs/access.log" - + You can also use environement variables or the default variables var.PID and var.CWD: :: @@ -248,11 +248,11 @@ server.document-root might have specified with one of the above conditionals. Default: no default, required - + server.bind IP address, hostname or absolute path to the unix-domain socket the server listen on. - + Default: bind to all interfaces Example: :: @@ -260,14 +260,14 @@ server.bind server.bind = "127.0.0.1" server.bind = "www.example.org" server.bind = "/tmp/lighttpd.socket" - + server.port tcp-port to bind the server to - + .. note:: port belows 1024 require root-permissions - + Default: 80 (443 if ssl is enabled) - + server.use-ipv6 bind to the IPv6 socket @@ -275,42 +275,42 @@ server.tag set the string returned by the Server: response header Default: lighttpd - + server.errorlog pathname of the error-log - + Default: either STDERR or ``server.errorlog-use-syslog`` - + server.errorlog-use-syslog send errorlog to syslog - + Default: disabled - + server.chroot root-directory of the server - + NOTE: requires root-permissions - + server.username username used to run the server - + NOTE: requires root-permissions server.groupname groupname used to run the server - + NOTE: requires root-permissions server.follow-symlink allow to follow-symlinks - + Default: enabled index-file.names list of files to search for if a directory is requested e.g.: :: - index-file.names = ( "index.php", "index.html", + index-file.names = ( "index.php", "index.html", "index.htm", "default.htm" ) if a name starts with slash this file will be used a index generator @@ -318,17 +318,17 @@ index-file.names server.modules modules to load - + .. note:: the order of the modules is important. The modules are executed in the order as they are specified. Loading mod_auth AFTER mod_fastcgi might disable authentication for fastcgi - backends (if check-local is disabled). + backends (if check-local is disabled). - As auth should be done first, move it before all executing modules (like + As auth should be done first, move it before all executing modules (like proxy, fastcgi, scgi and cgi). - rewrites, redirects and access should be first, followed by auth and + rewrites, redirects and access should be first, followed by auth and the docroot plugins. Afterwards the external handlers like fastcgi, cgi, scgi and proxy and @@ -336,12 +336,12 @@ server.modules e.g.: :: - server.modules = ( "mod_rewrite", - "mod_redirect", + server.modules = ( "mod_rewrite", + "mod_redirect", "mod_alias", - "mod_access", - "mod_auth", - "mod_status", + "mod_access", + "mod_auth", + "mod_status", "mod_simple_vhost", "mod_evhost", "mod_userdir", @@ -363,74 +363,74 @@ server.modules - mod_staticfile server.event-handler - set the event handler - + set the event handler + Default: "poll" server.pid-file - set the name of the .pid-file where the PID of the server should be placed. + set the name of the .pid-file where the PID of the server should be placed. This option is used in combination with a start-script and the daemon mode - + Default: not set - + server.max-request-size maximum size in kbytes of the request (header + body). Only applies to POST requests. - + Default: 2097152 (2GB) server.max-worker number of worker processes to spawn. This is usually only needed on servers which are fairly loaded and the network handler calls delay often (e.g. new requests are not handled instantaneously). - + Default: 0 - + server.name name of the server/virtual server - + Default: hostname server.max-keep-alive-requests - maximum number of request within a keep-alive session before the server + maximum number of request within a keep-alive session before the server terminates the connection - + Default: 128 server.max-keep-alive-idle maximum number of seconds until a idling keep-alive connection is droped - + Default: 30 server.max-read-idle - maximum number of seconds until a waiting, non keep-alive read times out + maximum number of seconds until a waiting, non keep-alive read times out and closes the connection - + Default: 60 server.max-write-idle maximum number of seconds until a waiting write call times out and closes the connection - + Default: 360 server.error-handler-404 uri to call if the requested file results in a 404 Default: not set - + Example: :: - + server.error-handler-404 = "/error-404.php" server.protocol-http11 defines if HTTP/1.1 is allowed or not. - + Default: enabled server.range-requests defines if range requests are allowed or not. - + Default: enabled @@ -445,9 +445,9 @@ debugging debug.dump-unknown-headers enables listing of internally unhandled HTTP-headers - + e.g. :: - + debug.dump-unknown-headers = "enable" mimetypes @@ -456,20 +456,20 @@ mimetypes mimetype.assign list of known mimetype mappings NOTE: if no mapping is given "application/octet-stream" is used - + e.g.: :: - - mimetype.assign = ( ".png" => "image/png", + + mimetype.assign = ( ".png" => "image/png", ".jpg" => "image/jpeg", ".jpeg" => "image/jpeg", ".html" => "text/html", ".txt" => "text/plain" ) - The list is compared top down and the first match is taken. This is + The list is compared top down and the first match is taken. This is important if you have matches like: :: ".tar.gz" => "application/x-tgz", - ".gz" => "application/x-gzip", + ".gz" => "application/x-gzip", If you want to set another default mimetype use: :: @@ -483,17 +483,17 @@ mimetype.use-xattr retrieve the "Content-Type" attribute on each file, and use that as the mime type. If it's not defined or not available, fall back to the mimetype.assign assignment. - + e.g.: :: - + mimetype.use-xattr = "enable" - + on shell use: - + $ attr -s Content-Type -V image/svg svgfile.svg - + or - + $ attr -s Content-Type -V text/html indexfile @@ -501,13 +501,13 @@ debugging ````````` debug.log-request-header - default: disabled - + default: disabled + debug.log-response-header - default: disabled + default: disabled debug.log-file-not-found - default: disabled + default: disabled debug.log-request-handling - default: disabled + default: disabled diff --git a/doc/dirlisting.txt b/doc/dirlisting.txt index ea65ba6..3b33752 100644 --- a/doc/dirlisting.txt +++ b/doc/dirlisting.txt @@ -13,10 +13,10 @@ Module: mod_dirlisting :abstract: mod_dirlisting generates HTML based directory listings with full CSS control - + .. meta:: :keywords: lighttpd, directory listings, dirlisting - + .. contents:: Table of Contents Description @@ -53,7 +53,7 @@ Options dir-listing.activate enables virtual directory listings if a directory is requested no - index-file was found + index-file was found Default: disabled @@ -78,5 +78,5 @@ dir-listing.encoding encoding) Example: :: - + dir-listing.encoding = "utf-8" diff --git a/doc/evhost.txt b/doc/evhost.txt index 9e79b03..441029c 100644 --- a/doc/evhost.txt +++ b/doc/evhost.txt @@ -12,10 +12,10 @@ Module: mod_evhost :abstract: virtual hosting - + .. meta:: :keywords: lighttpd, virtual hosting - + .. contents:: Table of Contents Description @@ -23,10 +23,10 @@ Description mod_evhost builds the document-root based on a pattern which contains wildcards. Those wildcards can represent parts if the submitted hostname - + :: - + %% => % sign %0 => domain name + tld %1 => tld @@ -39,7 +39,7 @@ wildcards. Those wildcards can represent parts if the submitted hostname Options ======= -evhost.path-pattern +evhost.path-pattern pattern with wildcards to be replace to build a documentroot - + diff --git a/doc/expire.txt b/doc/expire.txt index 2aee938..ca59c42 100644 --- a/doc/expire.txt +++ b/doc/expire.txt @@ -12,17 +12,17 @@ Module: mod_expire :abstract: mod_expire controls the setting of the the Expire Response header - + .. meta:: :keywords: lighttpd, expire - + .. contents:: Table of Contents Description =========== mod_expire controls the Expire header in the Response Header of HTTP/1.0 -messages. It is usefull to set it for static files which should be cached +messages. It is usefull to set it for static files which should be cached aggressivly like images, stylesheets or similar. Options @@ -35,8 +35,8 @@ expire.url following the syntax used by mod_expire in Apache 1.3.x and later. - + Example: :: - + expire.url = ( "/images/" => "access 1 hour" ) - + diff --git a/doc/fastcgi-state.txt b/doc/fastcgi-state.txt index 9e76a6f..a05d2c2 100644 --- a/doc/fastcgi-state.txt +++ b/doc/fastcgi-state.txt @@ -11,13 +11,13 @@ Module: fastcgi :Revision: $Revision: 1.1 $ :abstract: - This is a short summary of the state-engine which is driving the FastCGI + This is a short summary of the state-engine which is driving the FastCGI module. It describes the basic concepts and the way the different parts of the module are connected. - + .. meta:: :keywords: lighttpd, state-engine, fastcgi - + .. contents:: Table of Contents Description @@ -27,7 +27,7 @@ States ------ The state-engine is currently made of 6 states which are walk-through on -the way each connection. +the way each connection. :init: prepare fastcgi-connection @@ -41,7 +41,7 @@ the way each connection. read fastcgi-response from network and push it to the write-queue :close: terminate the connection - + .. image:: fastcgi-state.png Delays diff --git a/doc/fastcgi.txt b/doc/fastcgi.txt index a29cf48..fc46385 100644 --- a/doc/fastcgi.txt +++ b/doc/fastcgi.txt @@ -12,72 +12,72 @@ Module: mod_fastcgi :abstract: The FastCGI interface is the fastest and most secure way - to interface external process-handlers like Perl, PHP and - your self-written applications. - + to interface external process-handlers like Perl, PHP and + your self-written applications. + .. meta:: :keywords: lighttpd, FastCGI - + .. contents:: Table of Contents Description =========== -lighttpd provides an interface to a external programs that -support the FastCGI interface. The FastCGI Interface is -defined by http://www.fastcgi.com/ and is a +lighttpd provides an interface to a external programs that +support the FastCGI interface. The FastCGI Interface is +defined by http://www.fastcgi.com/ and is a platform-independent and server independent interface between a web-application and a webserver. -This means that FastCGI programs that run with the Apache +This means that FastCGI programs that run with the Apache Webserver will run seamlessly with lighttpd and vice versa. FastCGI ------- -FastCGI is removes a lot of the limitations of CGI programs. -CGI programs have the problem that they have to be restarted -by the webserver for every request which leads to really bad +FastCGI is removes a lot of the limitations of CGI programs. +CGI programs have the problem that they have to be restarted +by the webserver for every request which leads to really bad performance values. -FastCGI removes this limitation by keeping the process running -and handling the requests by this always running process. This -removes the time used for the fork() and the overall startup -and cleanup time which is necessary to create and destroy a +FastCGI removes this limitation by keeping the process running +and handling the requests by this always running process. This +removes the time used for the fork() and the overall startup +and cleanup time which is necessary to create and destroy a process. -While CGI programs communicate to the server over pipes, -FastCGI processes use Unix-Domain-Sockets or TCP/IP to talk -with the webserver. This gives you the second advantage over +While CGI programs communicate to the server over pipes, +FastCGI processes use Unix-Domain-Sockets or TCP/IP to talk +with the webserver. This gives you the second advantage over simple CGI programs: FastCGI don't have to run on the Webserver -itself but everywhere in the network. +itself but everywhere in the network. -lighttpd takes it a little bit further by providing a internal -FastCGI load-balancer which can be used to balance the load -over multiple FastCGI Servers. In contrast to other solutions -only the FastCGI process has to be on the cluster and not the +lighttpd takes it a little bit further by providing a internal +FastCGI load-balancer which can be used to balance the load +over multiple FastCGI Servers. In contrast to other solutions +only the FastCGI process has to be on the cluster and not the whole webserver. That gives the FastCGI process more resources than a e.g. load-balancer+apache+mod_php solution. -If you compare FastCGI against a apache+mod_php solution you -should note that FastCGI provides additional security as the -FastCGI process can be run under different permissions that -the webserver and can also live a chroot which might be -different than the one the webserver is running in. +If you compare FastCGI against a apache+mod_php solution you +should note that FastCGI provides additional security as the +FastCGI process can be run under different permissions that +the webserver and can also live a chroot which might be +different than the one the webserver is running in. Options ======= -lighttpd provides the FastCGI support via the fastcgi-module +lighttpd provides the FastCGI support via the fastcgi-module (mod_fastcgi) which provides 2 options in the config-file: fastcgi.debug - a value between 0 and 65535 to set the debug-level in the - FastCGI module. Currently only 0 and 1 are used. Use 1 to + a value between 0 and 65535 to set the debug-level in the + FastCGI module. Currently only 0 and 1 are used. Use 1 to enable some debug output, 0 to disable it. -fastcgi.map-extensions +fastcgi.map-extensions map multiple extensions to the same fastcgi server Example: :: @@ -85,23 +85,23 @@ fastcgi.map-extensions fastcgi.map-extensions = ( ".php3" => ".php" ) fastcgi.server - tell the module where to send FastCGI requests to. Every - file-extension can have it own handler. Load-Balancing is + tell the module where to send FastCGI requests to. Every + file-extension can have it own handler. Load-Balancing is done by specifying multiple handles for the same extension. - + structure of fastcgi.server section: :: - - ( => - ( + + ( => + ( ( "host" => , "port" => , "socket" => , # either socket # or host+port - "bin-path" => , # OPTIONAL - "bin-environment" => , # OPTIONAL - "bin-copy-environment" => , # OPTIONAL + "bin-path" => , # OPTIONAL + "bin-environment" => , # OPTIONAL + "bin-copy-environment" => , # OPTIONAL "mode" => , # OPTIONAL - "docroot" => , # OPTIONAL if "mode" + "docroot" => , # OPTIONAL if "mode" # is not "authorizer" "check-local" => , # OPTIONAL "min-procs" => , # OPTIONAL @@ -112,54 +112,54 @@ fastcgi.server "disable-time" => , # optional "allow-x-send-file" => # optional ), - ( "host" => ... - ) + ( "host" => ... + ) ) ) - - :: is the file-extension or prefix + + :: is the file-extension or prefix (if started with "/") :"host": is hostname/ip of the FastCGI process :"port": is tcp-port on the "host" used by the FastCGI process - :"bin-path": path to the local FastCGI binary which should be + :"bin-path": path to the local FastCGI binary which should be started if no local FastCGI is running :"socket": path to the unix-domain socket - :"mode": is the FastCGI protocol mode. - Default is "responder", also "authorizer" + :"mode": is the FastCGI protocol mode. + Default is "responder", also "authorizer" mode is implemented. - :"docroot": is optional and is the docroot on the remote - host for default "responder" mode. For - "authorizer" mode it is MANDATORY and it points + :"docroot": is optional and is the docroot on the remote + host for default "responder" mode. For + "authorizer" mode it is MANDATORY and it points to docroot for authorized requests. For security reasons it is recommended to keep this docroot outside of server.document-root tree. - :"check-local": is optional and may be "enable" (default) or - "disable". If enabled the server first check - for a file in local server.document-root tree + :"check-local": is optional and may be "enable" (default) or + "disable". If enabled the server first check + for a file in local server.document-root tree and return 404 (Not Found) if no such file. - If disabled, the server forward request to + If disabled, the server forward request to FastCGI interface without this check. - :"broken-scriptfilename": breaks SCRIPT_FILENAME in a wat that + :"broken-scriptfilename": breaks SCRIPT_FILENAME in a wat that PHP can extract PATH_INFO from it (default: disabled) :"disable-time": time to wait before a disabled backend is checked again :"allow-x-send-file": controls if X-LIGHTTPD-send-file headers - are allowed + are allowed If bin-path is set: :"min-procs": sets the minium processes to start :"max-procs": the upper limit of the processess to start :"max-load-per-proc": maximum number of waiting processes on - average per process before a new process is + average per process before a new process is spawned :"idle-timeout": number of seconds before a unused process gets terminated - :"bin-environment": put an entry into the environment of + :"bin-environment": put an entry into the environment of the started process :"bin-copy-environement": clean up the environment and copy - only the specified entries into the fresh + only the specified entries into the fresh environment of the spawn process @@ -167,9 +167,9 @@ Examples -------- Multiple extensions for the same host :: - + fastcgi.server = ( ".php" => - (( "host" => "127.0.0.1", + (( "host" => "127.0.0.1", "port" => 1026, "bin-path" => "/usr/local/bin/php" )), @@ -180,30 +180,30 @@ Examples ) Example with prefix: :: - + fastcgi.server = ( "/remote_scripts/" => (( "host" => "192.168.0.3", "port" => 9000, "check-local" => "disable", - "docroot" => "/" # remote server may use + "docroot" => "/" # remote server may use # it's own docroot )) ) - + The request `http://my.host.com/remote_scripts/test.cgi` will be forwarded to fastcgi server at 192.168.0.3 and the value "/remote_scripts/test.cgi" will be used for the SCRIPT_NAME - variable. Remote server may prepend it with its own - document root. The handling of index files is also the + variable. Remote server may prepend it with its own + document root. The handling of index files is also the resposibility of remote server for this case. - In the case that the prefix is not terminated with a slash + In the case that the prefix is not terminated with a slash the prefix will be handled as file and /test.cgi would become a PATH_INFO instead of part of SCRIPT_NAME. Example for "authorizer" mode: :: - + fastcgi.server = ( "/remote_scripts/" => (( "host" => "10.0.0.2", "port" => 9000, @@ -212,23 +212,23 @@ Examples )) ) - Note that if "docroot" is specified then its value will be + Note that if "docroot" is specified then its value will be used in DOCUMENT_ROOT and SCRIPT_FILENAME variables passed to FastCGI server. Load-Balancing ============== -The FastCGI plugin provides automaticly a load-balancing between +The FastCGI plugin provides automaticly a load-balancing between multiple FastCGI servers. :: - fastcgi.server = ( ".php" => + fastcgi.server = ( ".php" => (( "host" => "10.0.0.2", "port" => 1030 ), ( "host" => "10.0.0.3", "port" => 1030 )) ) -To understand how the load-balancing works you can enable the +To understand how the load-balancing works you can enable the fastcgi.debug option and will get a similar output as here: :: proc: 127.0.0.1 1031 1 1 1 31454 @@ -244,89 +244,89 @@ fastcgi.debug option and will get a similar output as here: :: proc: 127.0.0.1 1031 1 1 2 31454 proc: 127.0.0.1 1029 1 1 2 31447 -Even if this for multiple FastCGI children on the local machine +Even if this for multiple FastCGI children on the local machine the following explaination is valid for remote connections too. -The output shows: +The output shows: - IP, port, unix-socket (is empty here) - is-local, state (0 - unset, 1 - running, ... ) - active connections (load) - PID -As you can see the list is always sorted by the load field. +As you can see the list is always sorted by the load field. -Whenever a new connection is requested, the first entry (the one -with the lowest load) is selected, the load is increased (got proc: ...) +Whenever a new connection is requested, the first entry (the one +with the lowest load) is selected, the load is increased (got proc: ...) and the list is sorted again. -If a FastCGI request is done or the connection is dropped, the load on the +If a FastCGI request is done or the connection is dropped, the load on the FastCGI proc decreases and the list is sorted again (release proc: ...) -This behaviour is very light-weight in code and still very efficient -as it keeps the fastcgi-servers equally loaded even if they have different -CPUs. +This behaviour is very light-weight in code and still very efficient +as it keeps the fastcgi-servers equally loaded even if they have different +CPUs. Adaptive Process Spawning ========================= -.. note:: This feature is disabled in 1.3.14 again. min-procs is +.. note:: This feature is disabled in 1.3.14 again. min-procs is ignored in that release -Starting with 1.3.8 lighttpd can spawn processes on demand if +Starting with 1.3.8 lighttpd can spawn processes on demand if a bin-path is specified and the FastCGI process runs locally. -If you want to have a least one FastCGI process running and -more of the number of requests increases you can use min-procs +If you want to have a least one FastCGI process running and +more of the number of requests increases you can use min-procs and max-procs. -A new process is spawned as soon as the average number of +A new process is spawned as soon as the average number of requests waiting to be handle by a single process increases the -max-load-per-proc setting. +max-load-per-proc setting. The idle-timeout specifies how long a fastcgi-process should wait -for a new request before it kills itself. +for a new request before it kills itself. Example ------- :: - fastcgi.server = ( ".php" => + fastcgi.server = ( ".php" => (( "socket" => "/tmp/php.socket", "bin-path" => "/usr/local/bin/php", "min-procs" => 1, "max-procs" => 32, "max-load-per-proc" => 4, - "idle-timeout" => 20 + "idle-timeout" => 20 )) ) Disabling Adaptive Spawning --------------------------- -Adaptive Spawning is a quite new feature and it might misbehave -for your setup. There are several ways to control how the spawing +Adaptive Spawning is a quite new feature and it might misbehave +for your setup. There are several ways to control how the spawing is done: 1. ``"max-load-per-proc" => 1`` if that works for you, great. - + 2. If not set ``min-procs == max-procs``. - + 3. For PHP you can also use: :: - + $ PHP_FCGI_CHILDREN=384 ./lighttpd -f ./lighttpd.conf - - fastcgi.server = ( ".php" => + + fastcgi.server = ( ".php" => (( "socket" => "/tmp/php.socket", "bin-path" => "/usr/local/bin/php", "min-procs" => 1, "max-procs" => 1, "max-load-per-proc" => 4, - "idle-timeout" => 20 + "idle-timeout" => 20 )) ) - + It will create one socket and let's PHP create the 384 processes itself. 4. If you don't want lighttpd to manage the fastcgi processes, remove the @@ -334,26 +334,26 @@ is done: FastCGI and Programming Languages -================================= +================================= Preparing PHP as a FastCGI program ---------------------------------- -One of the most important application that has a FastCGI -interface is php which can be downloaded from -http://www.php.net/ . You have to recompile the php from -source to enable the FastCGI interface as it is normally +One of the most important application that has a FastCGI +interface is php which can be downloaded from +http://www.php.net/ . You have to recompile the php from +source to enable the FastCGI interface as it is normally not enabled by default in the distributions. -If you already have a working installation of PHP on a +If you already have a working installation of PHP on a webserver execute a small script which just contains :: -and search for the line in that contains the configure call. -You can use it as the base for the compilation. +and search for the line in that contains the configure call. +You can use it as the base for the compilation. -You have to remove all occurences of `--with-apxs`, `--with-apxs2` +You have to remove all occurences of `--with-apxs`, `--with-apxs2` and the like which would build PHP with Apache support. Add the next three switches to compile PHP with FastCGI support:: @@ -361,8 +361,8 @@ next three switches to compile PHP with FastCGI support:: --enable-fastcgi \ --enable-force-cgi-redirect \ ... - -After compilation and installation check that your PHP + +After compilation and installation check that your PHP binary contains FastCGI support by calling: :: $ php -v @@ -374,7 +374,7 @@ The important part is the (cgi-fcgi). Starting a FastCGI-PHP ---------------------- -Starting with version 1.3.6 lighttpd can spawn the FastCGI +Starting with version 1.3.6 lighttpd can spawn the FastCGI processes locally itself if necessary: :: fastcgi.server = ( ".php" => @@ -391,20 +391,20 @@ handles before it kills itself. :: fastcgi.server = ( ".php" => (( "socket" => "/tmp/php-fastcgi.socket", "bin-path" => "/usr/local/bin/php", - "bin-environment" => ( + "bin-environment" => ( "PHP_FCGI_CHILDREN" => "16", "PHP_FCGI_MAX_REQUESTS" => "10000" ) )) ) -To increase the security of the started process you should only pass +To increase the security of the started process you should only pass the necessary environment variables to the FastCGI process. :: fastcgi.server = ( ".php" => (( "socket" => "/tmp/php-fastcgi.socket", "bin-path" => "/usr/local/bin/php", - "bin-environment" => ( + "bin-environment" => ( "PHP_FCGI_CHILDREN" => "16", "PHP_FCGI_MAX_REQUESTS" => "10000" ), "bin-copy-environment" => ( @@ -425,7 +425,7 @@ and the option ``broken-scriptfilename`` in your fastcgi.server config: :: fastcgi.server = ( ".php" => (( "socket" => "/tmp/php-fastcgi.socket", "bin-path" => "/usr/local/bin/php", - "bin-environment" => ( + "bin-environment" => ( "PHP_FCGI_CHILDREN" => "16", "PHP_FCGI_MAX_REQUESTS" => "10000" ), "bin-copy-environment" => ( @@ -434,17 +434,17 @@ and the option ``broken-scriptfilename`` in your fastcgi.server config: :: )) ) -Why this ? the ``cgi.fix_pathinfo = 0`` would give you a working ``PATH_INFO`` +Why this ? the ``cgi.fix_pathinfo = 0`` would give you a working ``PATH_INFO`` but no ``PHP_SELF``. If you enable it, it turns around. To fix the ``PATH_INFO`` `--enable-discard-path` needs a SCRIPT_FILENAME which is against the CGI spec, a broken-scriptfilename. With ``cgi.fix_pathinfo = 1`` in php.ini and -``broken-scriptfilename => "enable"`` you get both. +``broken-scriptfilename => "enable"`` you get both. External Spawning ----------------- -Spawning FastCGI processes directly in the webserver has some +Spawning FastCGI processes directly in the webserver has some disadvantages like - FastCGI process can only run locally @@ -456,54 +456,54 @@ take off some load from the webserver you have to control the FastCGI process by a external program like spawn-fcgi. spawn-fcgi is used to start a FastCGI process in its own -environment and set the user-id, group-id and change to +environment and set the user-id, group-id and change to another root-directory (chroot). -For convenience a wrapper script should be used which takes -care of all the necessary option. Such a script in included +For convenience a wrapper script should be used which takes +care of all the necessary option. Such a script in included in the lighttpd distribution and is call spawn-php.sh. -The script has a set of config variables you should take +The script has a set of config variables you should take a look at: :: ## ABSOLUTE path to the spawn-fcgi binary SPAWNFCGI="/usr/local/sbin/spawn-fcgi" - + ## ABSOLUTE path to the PHP binary FCGIPROGRAM="/usr/local/bin/php" - + ## bind to tcp-port on localhost FCGIPORT="1026" - + ## bind to unix domain socket # FCGISOCKET="/tmp/php.sock" - + ## number of PHP childs to spawn PHP_FCGI_CHILDREN=10 - + ## number of request server by a single php-process until ## is will be restarted PHP_FCGI_MAX_REQUESTS=1000 - + ## IP adresses where PHP should access server connections ## from FCGI_WEB_SERVER_ADDRS="127.0.0.1,192.168.0.1" - + # allowed environment variables sperated by spaces ALLOWED_ENV="ORACLE_HOME PATH USER" - + ## if this script is run as root switch to the following user USERID=wwwrun GROUPID=wwwrun -If you have set the variables to values that fit to your +If you have set the variables to values that fit to your setup you can start it by calling: :: $ spawn-php.sh spawn-fcgi.c.136: child spawned successfully: PID: 6925 -If you get "child spawned successfully: PID:" the php -processes could be started successfully. You should see them +If you get "child spawned successfully: PID:" the php +processes could be started successfully. You should see them in your processlist: :: $ ps ax | grep php @@ -511,22 +511,22 @@ in your processlist: :: 6928 ? S 0:00 /usr/local/bin/php ... -The number of processes should be PHP_FCGI_CHILDREN + 1. -Here the process 6925 is the master of the slaves which -handle the work in parallel. Number of parallel workers can -be set by PHP_FCGI_CHILDREN. A worker dies automaticly of -handling PHP_FCGI_MAX_REQUESTS requests as PHP might have +The number of processes should be PHP_FCGI_CHILDREN + 1. +Here the process 6925 is the master of the slaves which +handle the work in parallel. Number of parallel workers can +be set by PHP_FCGI_CHILDREN. A worker dies automaticly of +handling PHP_FCGI_MAX_REQUESTS requests as PHP might have memory leaks. -If you start the script as user root php processes will be -running as the user USERID and group GROUPID to drop the -root permissions. Otherwise the php processes will run as +If you start the script as user root php processes will be +running as the user USERID and group GROUPID to drop the +root permissions. Otherwise the php processes will run as the user you started script as. -As the script might be started from a unknown stage or even -directly from the command-line it cleans the environment -before starting the processes. ALLOWED_ENV contains all -the external environement variables that should be available +As the script might be started from a unknown stage or even +directly from the command-line it cleans the environment +before starting the processes. ALLOWED_ENV contains all +the external environement variables that should be available to the php-process. @@ -539,7 +539,7 @@ Skeleton for remote authorizer ============================== The basic functionality of authorizer is as follows (see -http://www.fastcgi.com/devkit/doc/fcgi-spec.html, 6.3 for +http://www.fastcgi.com/devkit/doc/fcgi-spec.html, 6.3 for details). :: #include @@ -547,25 +547,25 @@ details). :: #include int main () { char* p; - - while (FCGI_Accept() >= 0) { + + while (FCGI_Accept() >= 0) { /* wait for fastcgi authorizer request */ - + printf("Content-type: text/html\r\n"); - + if ((p = getenv("QUERY_STRING")) == NULL) || ) printf("Status: 403 Forbidden\r\n\r\n"); - else printf("\r\n"); + else printf("\r\n"); /* default Status is 200 - allow access */ } - + return 0; } -It is possible to use any other variables provided by -FastCGI interface for authorization check. Here is only an +It is possible to use any other variables provided by +FastCGI interface for authorization check. Here is only an example. @@ -578,22 +578,22 @@ If you get: :: (fcgi.c.274) connect delayed: 8 (fcgi.c.289) connect succeeded: 8 - (fcgi.c.745) unexpected end-of-file (perhaps the fastcgi + (fcgi.c.745) unexpected end-of-file (perhaps the fastcgi process died): 8 -the fastcgi process accepted the connection but closed it -right away. This happens if FCGI_WEB_SERVER_ADDRS doesn't +the fastcgi process accepted the connection but closed it +right away. This happens if FCGI_WEB_SERVER_ADDRS doesn't include the host where you are connection from. If you get :: (fcgi.c.274) connect delayed: 7 - (fcgi.c.1107) error: unexpected close of fastcgi connection + (fcgi.c.1107) error: unexpected close of fastcgi connection for /peterp/seite1.php (no fastcgi process on host/port ?) - (fcgi.c.1015) emergency exit: fastcgi: connection-fd: 5 + (fcgi.c.1015) emergency exit: fastcgi: connection-fd: 5 fcgi-fd: 7 -the fastcgi process is not running on the host/port you are +the fastcgi process is not running on the host/port you are connection to. Check your configuration. If you get :: @@ -601,6 +601,6 @@ If you get :: (fcgi.c.274) connect delayed: 7 (fcgi.c.289) connect succeeded: 7 -everything is fine. The connect() call just was delayed a +everything is fine. The connect() call just was delayed a little bit and is completly normal. diff --git a/doc/features.txt b/doc/features.txt index cfccbb1..f45fe08 100644 --- a/doc/features.txt +++ b/doc/features.txt @@ -7,12 +7,12 @@ progress report :Revision: $Revision: 1.2 $ :abstract: - This document tries to track the requested features and + This document tries to track the requested features and the release when they have been implemented. - + .. meta:: :keywords: lighttpd, features - + .. contents:: Table of Contents Description @@ -29,17 +29,17 @@ It is used to see what is still missing and what is already done. :: > considering installing and testing the latest version. From a > quick glance, it seems to support most/all of the features of > Premium thttpd and Zeus. - + If you think it compares to Zeus, then you've obviously never used Zeus. - + lighttpd is currently the only non-blocking open source web server to support FastCGI responders and that's worthwhile. - + The documentation is lacking. Comments in the configuration file do not make up for a complete manual. - + Constantly improving. :: - + The configuration syntax is overly complex, like Apache. There is no .htaccess support. @@ -50,34 +50,34 @@ Constantly improving. :: SSL. Works since 1.3.0. :: - + There is no SSI support. Zeus has full recursive SSI support. Output from a FastCGI program can get run through the SSI interpreter. SSI can also do virtual includes recursively. - + SSI works since 1.2.4. :: - + Request logging is not configurable. Zeus supports fully configurable access logging, plus a binary version of CLF that save space. - + 1.2.6 adds Apache-like logfile config. :: - + Access control only allows authentication via username and password. There is no way to allow or deny based in IP address. - + planed for 1.3.x :: - + The request rewriting appears to only allow regex substitutions. Zeus has a simple, yet powerful, request rewrite language. - - + + There is no support for FastCGI authorizers. These are very useful for high traffic sites that require complex authentication schemes or that store authorization information in a central database. - + since 1.1.9. :: - + There is no bandwidth throttling support. Zeus does bandwidth throttling correctly (i.e. unlike past versions of thttpd) and can throttle on a per-subserver (thttpd-style virtual hosts) basis. @@ -88,29 +88,29 @@ since 1.3.8. :: modification of web server behavior. While it isn't strictly necessary for an open source web server, it nice to have a documented, consistent API, rather than having to manually patch the server. - + If someone requests it it might be implemented. :: - + There is no web based interface. Zeus has a complete web based interface for everything, including a powerful feature of configuring multiple virtual servers at once. - + That is something that should be a special feature of Zeus. :) :: - + There is no support for mapping certain URLs to specific filesystem paths. - + since 1.2.6 :: - + There is no referring checking. This is incredibly important to prevent hotlinking of bandwidth intensive media types (images, movies, etc.). - + we have something better: mod_secdownload. And if someone wants referer checking we have a condition in the config for it since 1.2.9 :: - + Zeus has a lot of features that lighttpd doesn't have, but I only mentioned the ones I care about and use. - - -- + + -- David Phillips http://david.acz.org/ diff --git a/doc/magnet.txt b/doc/magnet.txt new file mode 100644 index 0000000..9d7697a --- /dev/null +++ b/doc/magnet.txt @@ -0,0 +1,429 @@ +{{{ +#!rst +============== +a power-magnet +============== + +------------------ +Module: mod_magnet +------------------ + + + +.. contents:: Table of Contents + +Requirements +============ + +:Version: lighttpd 1.4.12 or higher +:Packages: lua >= 5.1 + +Overview +======== + +mod_magnet is a module to control the request handling in lighty. + +.. note:: + + Keep in mind that the magnet is executed in the core of lighty. EVERY long-running operation is blocking + ALL connections in the server. You are warned. For time-consuming or blocking scripts use mod_fastcgi and friends. + +For performance reasons mod_magnet caches the compiled script. For each script-run the script itself is checked for +freshness and recompile if neccesary. + + +Installation +============ + +mod_magnet needs a lighty which is compiled with the lua-support ( --with-lua). Lua 5.1 or higher are required by +the module. Use "--with-lua=lua5.1" to install on Debian and friends. :: + + server.modules = ( ..., "mod_magnet", ... ) + +Options +======= + +mod_magnet can attract a request in several stages in the request-handling. + +* either at the same level as mod_rewrite, before any parsing of the URL is done +* or at a later stage, when the doc-root is known and the physical-path is already setup + +It depends on the purpose of the script which stage you want to intercept. Usually you want to use +the 2nd stage where the physical-path which relates to your request is known. At this level you +can run checks against lighty.env["physical.path"]. + +:: + + magnet.attract-raw-url-to = ( ... ) + magnet.attract-physical-path-to = ( ... ) + +You can define multiple scripts when separated by a semicolon. The scripts are executed in the specified +order. If one of them a returning a status-code, the following scripts will not be executed. + +Tables +====== + +Most of the interaction between between mod_magnet and lighty is done through tables. Tables in lua are hashes (Perl), dictionaries (Java), arrays (PHP), ... + +Request-Environment +------------------- + +Lighttpd has its internal variables which are exported as read/write to the magnet. + +If "http://example.org/search.php?q=lighty" is requested this results in a request like :: + + GET /search.php?q=lighty HTTP/1.1 + Host: example.org + +When you are using ``attract-raw-url-to`` you can access the following variables: + +* parts of the request-line + + * lighty.env["request.uri"] = "/search.php?q=lighty" + +* HTTP request-headers + + * lighty.request["Host"] = "example.org" + +Later in the request-handling, the URL is splitted, cleaned up and turned into a physical path name: + +* parts of the URI + + * lighty.env["uri.path"] = "/search.php" + * lighty.env["uri.path-raw"] = "/search.php" + * lighty.env["uri.scheme"] = "http" + * lighty.env["uri.authority"] = "example.org" + * lighty.env["uri.query"] = "q=lighty" + +* filenames, pathnames + + * lighty.env["physical.path"] = "/my-docroot/search.php" + * lighty.env["physical.rel-path"] = "/search.php" + * lighty.env["physical.doc-root"] = "/my-docroot" + +All of them are readable, not all of the are writable (or don't have an effect if you write to them). + +As a start, you might want to use those variables for writing: :: + + -- 1. simple rewriting is done via the request.uri + lighty.env["request.uri"] = ... + return lighty.RESTART_REQUEST + + -- 2. changing the physical-path + lighty.env["physical.path"] = ... + + -- 3. changing the query-string + lighty.env["uri.query"] = ... + +Response Headers +---------------- + +If you want to set a response header for your request, you can add a field to the lighty.header[] table: :: + + lighty.header["Content-Type"] = "text/html" + +Sending Content +=============== + +You can generate your own content and send it out to the clients. :: + + lighty.content = { "
", { filename = "/etc/passwd" }, "
" } + lighty.header["Content-Type"] = "text/html" + + return 200 + +The lighty.content[] table is executed when the script is finished. The elements of the array are processed left to right and the elements can either be a string or a table. Strings are included AS IS into the output of the request. + +* Strings + + * are included as is + +* Tables + + * filename = "" is required + * offset = [default: 0] + * length = [default: size of the file - offset] + +Internally lighty will use the sendfile() call to send out the static files at full speed. + +Status Codes +============ + +You might have seen it already in other examples: In case you are handling the request completly in the magnet you +can return your own status-codes. Examples are: Redirected, Input Validation, ... :: + + if (lighty.env["uri.scheme"] == "http") then + lighty.header["Location"] = "https://" .. lighty.env["uri.authority"] .. lighty.env["request.uri"] + return 302 + end + +You every number above and equal to 100 is taken as final status code and finishes the request. No other modules are +executed after this return. + +A special return-code is lighty.RESTART_REQUEST (currently equal to 99) which is usually used in combination with +changing the request.uri in a rewrite. It restarts the splitting of the request-uri again. + +If you return nothing (or nil) the request-handling just continues. + +Debugging +========= + +To easy debugging we overloaded the print()-function in lua and redirect the output of print() to the error-log. :: + + print("Host: " .. lighty.request["Host"]) + print("Request-URI: " .. lighty.env["request.uri"]) + + +Examples +======== + +Sending text-files as HTML +-------------------------- + +This is a bit simplistic, but it illustrates the idea: Take a text-file and cover it in a
 tag.
+
+Config-file ::
+
+  magnet.attract-physical-path-to = server.docroot + "/readme.lua"
+
+readme.lua ::
+
+  lighty.content = { "
", { filename = "/README" }, "
" } + lighty.header["Content-Type"] = "text/html" + + return 200 + +Maintainance pages +------------------ + +Your side might be on maintainance from time to time. Instead of shutting down the server confusing all +users, you can just send a maintainance page. + +Config-file :: + + magnet.attract-physical-path-to = server.docroot + "/maintainance.lua" + +maintainance.lua :: + + require "lfs" + + if (nil == lfs.attributes(lighty.env["physical.doc-root"] .. "/maintainance.html")) then + lighty.content = ( lighty.env["physical.doc-root"] .. "/maintainance.html" ) + + lighty.header["Content-Type"] = "text/html" + + return 200 + end + +mod_flv_streaming +----------------- + +Config-file :: + + magnet.attract-physical-path-to = server.docroot + "/flv-streaming.lua" + +flv-streaming.lua:: + + if (lighty.env["uri.query"]) then + -- split the query-string + get = {} + for k, v in string.gmatch(lighty.env["uri.query"], "(%w+)=(%w+)") do + get[k] = v + end + + if (get["start"]) then + -- missing: check if start is numeric and positive + + -- send te FLV header + a seek into the file + lighty.content = { "FLV\x1\x1\0\0\0\x9\0\0\0\x9", + { filename = lighty.env["physical.path"], offset = get["start"] } } + lighty.header["Content-Type"] = "video/x-flv" + + return 200 + end + end + + +selecting a random file from a directory +---------------------------------------- + +Say, you want to send a random file (ad-content) from a directory. + +To simplify the code and to improve the performance we define: + +* all images have the same format (e.g. image/png) +* all images use increasing numbers starting from 1 +* a special index-file names the highest number + +Config :: + + server.modules += ( "mod_magnet" ) + magnet.attract-physical-path-to = "random.lua" + +random.lua :: + + dir = lighty.env["physical.path"] + + f = assert(io.open(dir .. "/index", "r")) + maxndx = f:read("*all") + f:close() + + ndx = math.random(maxndx) + + lighty.content = { { filename = dir .. "/" .. ndx }} + lighty.header["Content-Type"] = "image/png" + + return 200 + +denying illegal character sequences in the URL +---------------------------------------------- + +Instead of implementing mod_security, you might just want to apply filters on the content +and deny special sequences that look like SQL injection. + +A common injection is using UNION to extend a query with another SELECT query. + +:: + + if (string.find(lighty.env["request.uri"], "UNION%s")) then + return 400 + end + +Traffic Quotas +-------------- + +If you only allow your virtual hosts a certain amount for traffic each month and want to +disable them if the traffic is reached, perhaps this helps: :: + + host_blacklist = { ["www.example.org"] = 0 } + + if (host_blacklist[lighty.request["Host"]]) then + return 404 + end + +Just add the hosts you want to blacklist into the blacklist table in the shown way. + +Complex rewrites +---------------- + +If you want to implement caching on your document-root and only want to regenerate +content if the requested file doesn't exist, you can attract the physical.path: :: + + magnet.attract-physical-path-to = ( server.document-root + "/rewrite.lua" ) + +rewrite.lua :: + + require "lfs" + + attr = lfs.attributes(lighty.env["physical.path"]) + + if (not attr) then + -- we couldn't stat() the file for some reason + -- let the backend generate it + + lighty.env["uri.path"] = "/dispatch.fcgi" + lighty.env["physical.rel-path"] = lighty.env["uri.path"] + lighty.env["physical.path"] = lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"] + fi + +luafilesystem ++++++++++++++ + +We are requiring the lua-module 'lfs' (http://www.keplerproject.org/luafilesystem/). + +I had to compile lfs myself for lua-5.1 which required a minor patch as compat-5.1 is not needed:: + + $ wget http://luaforge.net/frs/download.php/1487/luafilesystem-1.2.tar.gz + $ wget http://www.lighttpd.net/download/luafilesystem-1.2-lua51.diff + $ gzip -cd luafilesystem-1.2.tar.gz | tar xf - + $ cd luafilesystem-1.2 + $ patch -ls -p1 < ../luafilesystem-1.2-lua51.diff + $ make install + +It will install lfs.so into /usr/lib/lua/5.1/ which is where lua expects the extensions on my system. + +SuSE and Gentoo are known to have their own lfs packages and don't require a compile. + +Usertracking +------------ + +... or how to store data globally in the script-context: + +Each script has its own script-context. When the script is started it only contains the lua-functions +and the special lighty.* name-space. If you want to save data between script runs, you can use the global-script +context: + +:: + + if (nil == _G["usertrack"]) then + _G["usertrack"] = {} + end + if (nil == _G["usertrack"][lighty.request["Cookie"]]) then + _G["usertrack"][lighty.request["Cookie"]] + else + _G["usertrack"][lighty.request["Cookie"]] = _G["usertrack"][lighty.request["Cookie"]] + 1 + end + + print _G["usertrack"][lighty.request["Cookie"]] + +The global-context is per script. If you update the script without restarting the server, the context will still be maintained. + +Counters +-------- + +mod_status support a global statistics page and mod_magnet allows to add and update values in the status page: + +Config :: + + status.statistics-url = "/server-counters" + magnet.attract-raw-url-to = server.docroot + "/counter.lua" + +counter.lua :: + + lighty.status["core.connections"] = lighty.status["core.connections"] + 1 + +Result:: + + core.connections: 7 + fastcgi.backend.php-foo.0.connected: 0 + fastcgi.backend.php-foo.0.died: 0 + fastcgi.backend.php-foo.0.disabled: 0 + fastcgi.backend.php-foo.0.load: 0 + fastcgi.backend.php-foo.0.overloaded: 0 + fastcgi.backend.php-foo.1.connected: 0 + fastcgi.backend.php-foo.1.died: 0 + fastcgi.backend.php-foo.1.disabled: 0 + fastcgi.backend.php-foo.1.load: 0 + fastcgi.backend.php-foo.1.overloaded: 0 + fastcgi.backend.php-foo.load: 0 + +Porting mod_cml scripts +----------------------- + +mod_cml got replaced by mod_magnet. + +A CACHE_HIT in mod_cml:: + + output_include = { "file1", "file2" } + + return CACHE_HIT + +becomes:: + + content = { { filename = "/path/to/file1" }, { filename = "/path/to/file2"} } + + return 200 + +while a CACHE_MISS like (CML) :: + + trigger_handler = "/index.php" + + return CACHE_MISS + +becomes (magnet) :: + + lighty.env["request.uri"] = "/index.php" + + return lighty.RESTART_REQUEST + +}}} \ No newline at end of file diff --git a/doc/performance.txt b/doc/performance.txt index 56a7ca1..04d48a1 100644 --- a/doc/performance.txt +++ b/doc/performance.txt @@ -115,13 +115,13 @@ Solaris sendfilev FreeBSD sendfile ========== ========== -The best backend is selected at compile time. In case you want to use -another backend set: :: +The best backend is selected at compile time. In case you want to use +another backend set: :: server.network-backend = "writev" -You can find more information about network backend in: - +You can find more information about network backend in: + http://blog.lighttpd.net/articles/2005/11/11/optimizing-lighty-for-high-concurrent-large-file-downloads diff --git a/doc/plugins.txt b/doc/plugins.txt index 91c81fd..22dee40 100644 --- a/doc/plugins.txt +++ b/doc/plugins.txt @@ -13,23 +13,23 @@ Module: core :abstract: The plugin interface is an integral part of lighttpd which provides a flexible way to add specific functionality to lighttpd. - + .. meta:: :keywords: lighttpd, plugins - + .. contents:: Table of Contents Description =========== Plugins allow you to enhance the functionality of lighttpd without -changing the core of the webserver. They can be loaded at startup time +changing the core of the webserver. They can be loaded at startup time and can change virtually any aspect of the behaviour of the webserver. Plugin Entry Points ------------------- -lighttpd has 16 hooks which are used in different states of the +lighttpd has 16 hooks which are used in different states of the execution of the request: Serverwide hooks @@ -49,7 +49,7 @@ Serverwide hooks Connectionwide hooks ```````````````````` -Most of these hooks are called in ``http_response_prepare()`` after some +Most of these hooks are called in ``http_response_prepare()`` after some fields in the connection structure are set. :handle_uri_raw_: @@ -57,13 +57,13 @@ fields in the connection structure are set. :handle_uri_clean_: called after uri.path (a clean URI without .. and %20) is set :handle_docroot_: - called at the end of the logical path handle to get a docroot + called at the end of the logical path handle to get a docroot :handle_subrequest_start_: called if the physical path is set up and checked :handle_subrequest_: called at the end of ``http_response_prepare()`` :handle_physical_path_: - called after the physical path is created and no other handler is + called after the physical path is created and no other handler is found for this request :handle_request_done_: called when the request is done @@ -73,7 +73,7 @@ fields in the connection structure are set. called after the connection_state_engine is left again and plugin internal handles have to be called :connection_reset_: - called if the connection structure has to be cleaned up + called if the connection structure has to be cleaned up Plugin Interface @@ -82,14 +82,14 @@ Plugin Interface \*_plugin_init `````````````` -Every plugin has a uniquely-named function which is called after the -plugin is loaded. It is used to set up the ``plugin`` structure with +Every plugin has a uniquely-named function which is called after the +plugin is loaded. It is used to set up the ``plugin`` structure with some useful data: - name of the plugin ``name`` -- all hooks +- all hooks -The field ``data`` and ``lib`` should not be touched in the init function. +The field ``data`` and ``lib`` should not be touched in the init function. ``lib`` is the library handler from dlopen and ``data`` will be the storage of the internal plugin data. @@ -99,9 +99,9 @@ of the internal plugin data. init ```` -The first real call of a plugin function is the init hook which is used -to set up the internal plugin data. The internal plugin is assigned the -``data`` field mentioned in the \*_plugin_init description. +The first real call of a plugin function is the init hook which is used +to set up the internal plugin data. The internal plugin is assigned the +``data`` field mentioned in the \*_plugin_init description. :returns: a pointer to the internal plugin data. @@ -109,7 +109,7 @@ to set up the internal plugin data. The internal plugin is assigned the cleanup ``````` -The cleanup hook is called just before the plugin is unloaded. It is meant +The cleanup hook is called just before the plugin is unloaded. It is meant to free all buffers allocated in ``init`` or somewhere else in the plugin which are still not freed and to close all handles which were opened and are not closed yet. @@ -120,16 +120,16 @@ are not closed yet. set_defaults ```````````` -set_defaults is your entry point into the configfile parsing. It should +set_defaults is your entry point into the configfile parsing. It should pass a list of options to ``config_insert_values`` and check if -the plugin configuration is valid. If it is not valid yet, it should +the plugin configuration is valid. If it is not valid yet, it should set useful defaults or return with HANDLER_ERROR and an error message. :returns: HANDLER_GO_ON if ok - + HANDLER_ERROR will terminate lighttpd - + connection_reset ```````````````` @@ -137,9 +137,9 @@ called at the end of each request :returns: HANDLER_GO_ON if ok - + HANDLER_ERROR on error - + handle_trigger `````````````` @@ -147,9 +147,9 @@ called once a second :returns: HANDLER_GO_ON if ok - + HANDLER_ERROR on error - + handle_sighup ````````````` @@ -157,9 +157,9 @@ called if a SIGHUP is received (cycling logfiles, ...) :returns: HANDLER_GO_ON if ok - + HANDLER_ERROR on error - + handle_uri_raw `````````````` @@ -168,9 +168,9 @@ called after uri_raw is set :returns: HANDLER_GO_ON if ok HANDLER_FINISHED if the final output is prepared - + HANDLER_ERROR on error - + handle_uri_clean ```````````````` @@ -179,9 +179,9 @@ called after uri.path is set :returns: HANDLER_GO_ON if ok HANDLER_FINISHED if the final output is prepared - + HANDLER_ERROR on error - + handle_docroot `````````````` @@ -190,9 +190,9 @@ called when a docroot is needed :returns: HANDLER_GO_ON if ok HANDLER_FINISHED if the final output is prepared - + HANDLER_ERROR on error - + handle_subrequest_start ``````````````````````` @@ -201,9 +201,9 @@ called after physical.path is set :returns: HANDLER_GO_ON if ok HANDLER_FINISHED if the final output is prepared - + HANDLER_ERROR on error - + handle_subrequest ````````````````` @@ -212,9 +212,9 @@ called if subrequest_start requested a COMEBACK or a WAIT_FOR_EVENT :returns: HANDLER_GO_ON if ok HANDLER_FINISHED if the final output is prepared - + HANDLER_ERROR on error - + handle_physical_path ```````````````````` @@ -223,9 +223,9 @@ called after physical.path is set :returns: HANDLER_GO_ON if ok HANDLER_FINISHED if the final output is prepared - + HANDLER_ERROR on error - + handle_request_done ``````````````````` @@ -234,9 +234,9 @@ called at the end of the request (logging, statistics, ...) :returns: HANDLER_GO_ON if ok - + HANDLER_ERROR on error - + handle_connection_close ``````````````````````` @@ -244,9 +244,9 @@ called if the connection is terminated :returns: HANDLER_GO_ON if ok - + HANDLER_ERROR on error - + handle_joblist `````````````` @@ -254,7 +254,7 @@ called if the state of the connection has changed :returns: HANDLER_GO_ON if ok - + HANDLER_ERROR on error - + diff --git a/doc/proxy.txt b/doc/proxy.txt index 8ff5c3e..b8a3997 100644 --- a/doc/proxy.txt +++ b/doc/proxy.txt @@ -11,12 +11,12 @@ Module: mod_proxy :Revision: $Revision: 1.1 $ :abstract: - The proxy module a simplest way to connect lighttpd to + The proxy module a simplest way to connect lighttpd to java servers which have a HTTP-interface. - + .. meta:: :keywords: lighttpd, Proxy - + .. contents:: Table of Contents Description @@ -27,17 +27,17 @@ Description Options ======= -lighttpd provides the Proxy support via the proxy-module +lighttpd provides the Proxy support via the proxy-module (mod_proxy) which provides 2 options in the config-file: :proxy.debug: - a value between 0 and 65535 to set the debug-level in the - Proxy module. Currently only 0 and 1 are used. Use 1 to + a value between 0 and 65535 to set the debug-level in the + Proxy module. Currently only 0 and 1 are used. Use 1 to enable some debug output, 0 to disable it. :proxy.balance: might be one of 'hash', 'round-robin' or 'fair' (default). - + 'round-robin' choses another host for each request, 'hash' is generating a hash over the request-uri and makes sure that the same request URI is sent to always the same host. @@ -46,22 +46,22 @@ lighttpd provides the Proxy support via the proxy-module load-based, passive balancing. :proxy.server: - tell the module where to send Proxy requests to. Every - file-extension can have its own handler. Load-Balancing is + tell the module where to send Proxy requests to. Every + file-extension can have its own handler. Load-Balancing is done by specifying multiple handles for the same extension. - + structure of proxy.server section: :: - - ( => - ( + + ( => + ( ( "host" => , "port" => ), ( "host" => , "port" => ) ), - => ... + => ... ) - + :: is the file-extension or prefix (if started with "/") might empty to match all requests :"host": is ip of the proxy server @@ -69,9 +69,9 @@ lighttpd provides the Proxy support via the proxy-module server (default: 80) e.g.: :: - + proxy.server = ( ".jsp" => - ( ( + ( ( "host" => "10.0.0.242", "port" => 81 ) ) @@ -80,8 +80,8 @@ lighttpd provides the Proxy support via the proxy-module Example: ======== -Using lighttpd + mod_proxy in front of 8 Squids which handle the -caching of dynamic content for you. All requests for the host +Using lighttpd + mod_proxy in front of 8 Squids which handle the +caching of dynamic content for you. All requests for the host www.example.org should be forwarded to the proxy. All proxies listen on port 80 for requests. :: @@ -97,7 +97,7 @@ listen on port 80 for requests. :: ( "host" => "10.0.0.17" ) ) ) } -If one of the hosts goes down the all requests for this one server are +If one of the hosts goes down the all requests for this one server are moved equally to the other servers. If you want to know more about the algorithm used here google for 'Microsoft CARP'. diff --git a/doc/rc.lighttpd b/doc/rc.lighttpd index 4dd2a1e..da0d244 100755 --- a/doc/rc.lighttpd +++ b/doc/rc.lighttpd @@ -11,7 +11,7 @@ # /(usr/)sbin/rcFOO # # LSB compliant service control script; see http://www.linuxbase.org/spec/ -# +# # System startup script for some example service or daemon FOO (template) # ### BEGIN INIT INFO @@ -23,7 +23,7 @@ # Description: Start FOO to allow XY and provide YZ # continued on second line by '#' ### END INIT INFO -# +# # Note on Required-Start: It does specify the init script ordering, # not real dependencies. Depencies have to be handled by admin # resp. the configuration tools (s)he uses. @@ -64,7 +64,7 @@ rc_reset # 5 - program is not installed # 6 - program is not configured # 7 - program is not running -# +# # Note that starting an already running service, stopping # or restarting a not-running service as well as the restart # with force-reload (in case signalling is not supported) are @@ -76,7 +76,7 @@ case "$1" in ## Start daemon with startproc(8). If this fails ## the echo return value is set appropriate. - # NOTE: startproc returns 0, even if service is + # NOTE: startproc returns 0, even if service is # already running to match LSB spec. startproc $LIGHTTPD_BIN -f $LIGHTTPD_CONF_PATH @@ -94,7 +94,7 @@ case "$1" in rc_status -v ;; try-restart) - ## Stop the service and if this succeeds (i.e. the + ## Stop the service and if this succeeds (i.e. the ## service was running before), start it again. ## Note: try-restart is not (yet) part of LSB (as of 0.7.5) $0 status >/dev/null && $0 restart @@ -121,7 +121,7 @@ case "$1" in $0 start touch /var/run/lighttpd.pid rc_status -v - + ## Otherwise if it does not support reload: #rc_failed 3 #rc_status -v diff --git a/doc/redirect.txt b/doc/redirect.txt index 118ea8e..cf7cd75 100644 --- a/doc/redirect.txt +++ b/doc/redirect.txt @@ -12,10 +12,10 @@ Module: mod_redirect :abstract: url redirection - + .. meta:: :keywords: lighttpd, redirect - + .. contents:: Table of Contents Description @@ -28,9 +28,9 @@ Options url.redirect redirects a set of URLs externally - + e.g. :: - + url.redirect = ( "^/show/([0-9]+)/([0-9]+)$" => "http://www.example.org/show.php?isdn=$1&page$2", "^/get/([0-9]+)/([0-9]+)$" => "http://www.example.org/get.php?isdn=$1&page$2" ) diff --git a/doc/rewrite.txt b/doc/rewrite.txt index 09d4b66..e467022 100644 --- a/doc/rewrite.txt +++ b/doc/rewrite.txt @@ -12,10 +12,10 @@ Module: mod_rewrite :abstract: url rewrite - + .. meta:: :keywords: lighttpd, rewrite - + .. contents:: Table of Contents Description @@ -28,25 +28,25 @@ Options url.rewrite-once rewrites a set of URLs interally in the webserver BEFORE they are handled. - + e.g. :: - + url.rewrite-once = ( "" => "" ) - + url.rewrite-repeat rewrites a set of URLs interally in the webserver BEFORE they are handled - + e.g. :: - + url.rewrite-repeat = ( "" => "" ) -The options ``url.rewrite`` and ``url.rewrite-final`` were mapped to ``url.rewrite-once`` +The options ``url.rewrite`` and ``url.rewrite-final`` were mapped to ``url.rewrite-once`` in 1.3.16. Examples ======== -The regex is matching the full REQUEST_URI which is supplied by the user including +The regex is matching the full REQUEST_URI which is supplied by the user including query-string.:: url.rewrite-once = ( "^/id/([0-9]+)$" => "/index.php?id=$1", @@ -58,7 +58,7 @@ query-string.:: # * you can never change document-root by mod_rewrite # use mod_*host instead to make real mass-vhost - # request: http://any.domain.com/url/ + # request: http://any.domain.com/url/ # before rewrite: REQUEST_URI="/www/htdocs/url/" # and DOCUMENT_ROOT="/www/htdocs/" %0="www.domain.com" $1="url/" # after rewrite: REQUEST_URI="/www/htdocs/domain.com/url/" diff --git a/doc/rrdtool.txt b/doc/rrdtool.txt index 0e05cd3..1ad5543 100644 --- a/doc/rrdtool.txt +++ b/doc/rrdtool.txt @@ -50,7 +50,7 @@ Generating Graphs :: #!/bin/sh - + RRDTOOL=/usr/bin/rrdtool OUTDIR=/var/www/servers/www.example.org/pages/rrd/ INFILE=/var/www/lighttpd.rrd diff --git a/doc/scgi.txt b/doc/scgi.txt index eeb694c..dbb6371 100644 --- a/doc/scgi.txt +++ b/doc/scgi.txt @@ -13,10 +13,10 @@ Module: mod_scgi :abstract: SCGI is a fast and simplified CGI interface. It is mostly used by Python + WSGI. - + .. meta:: :keywords: lighttpd, FastCGI - + .. contents:: Table of Contents Description @@ -24,7 +24,7 @@ Description The SCGI module is heavily based on the FastCGI when it comes to configuration. Only the internal protocol between server -and client has been replaced. Please check the documentation +and client has been replaced. Please check the documentation of the FastCGI module for more information. History diff --git a/doc/secdownload.txt b/doc/secdownload.txt index 570b911..bf0a481 100644 --- a/doc/secdownload.txt +++ b/doc/secdownload.txt @@ -114,19 +114,19 @@ Your application has to generate the correct URLs. The following sample code for PHP should be easily adaptable to any other language: :: %s', $uri_prefix, $m, $t_hex, $f, $f); @@ -139,7 +139,7 @@ The server has to be configured in the same way. The URI prefix and secret have to match: :: server.modules = ( ..., "mod_secdownload", ... ) - + secdownload.secret = "verysecret" secdownload.document-root = "/home/www/servers/download-area/" secdownload.uri-prefix = "/dl/" diff --git a/doc/security.txt b/doc/security.txt index ebbbf68..766fd34 100644 --- a/doc/security.txt +++ b/doc/security.txt @@ -12,10 +12,10 @@ Module: core :abstract: lighttpd was developed with security in mind ... - + .. meta:: :keywords: lighttpd, security - + .. contents:: Table of Contents Description diff --git a/doc/setenv.txt b/doc/setenv.txt index 0238c10..c03474f 100644 --- a/doc/setenv.txt +++ b/doc/setenv.txt @@ -12,10 +12,10 @@ Module: mod_setenv :abstract: mod_setenv is used to add request - + .. meta:: :keywords: lighttpd, skeleton - + .. contents:: Table of Contents Description diff --git a/doc/simple-vhost.txt b/doc/simple-vhost.txt index d4b4db2..4f8338f 100644 --- a/doc/simple-vhost.txt +++ b/doc/simple-vhost.txt @@ -12,10 +12,10 @@ Module: mod_simple_vhost :abstract: virtual hosting - + .. meta:: :keywords: lighttpd, virtual hosting - + .. contents:: Table of Contents Description @@ -36,11 +36,11 @@ The document root for each vhost is built from three values: The complete document root is constructed either by :: server-root + hostname + document-root - + or if this path does not exist by :: server-root + default-host + document-root - + A small example should make this idea clear: :: /var/www/ @@ -52,7 +52,7 @@ A small example should make this idea clear: :: /var/www/servers/mail.example.org/ /var/www/servers/mail.example.org/lib/ /var/www/servers/mail.example.org/pages/ - + simple-vhost.server-root = "/var/www/servers/" simple-vhost.default-host = "www.example.org" simple-vhost.document-root = "pages" @@ -71,7 +71,7 @@ with one another. :: $HTTP["host"] == "news.example.org" { server.document-root = "/var/www/servers/news2.example.org/pages/" - } + } When ``news.example.org`` is requested, the ``server.document-root`` will be set to ``/var/www/servers/news2.example.org/pages/``, but @@ -91,7 +91,7 @@ To use conditionals together with simple-vhost, you should do this: :: $HTTP["host"] == "news.example.org" { server.document-root = "/var/www/servers/news2.example.org/pages/" - } + } It will enable simple vhosting for all hosts other than ``news.example.org``. @@ -100,10 +100,10 @@ Options simple-vhost.server-root root of the virtual host - + simple-vhost.default-host use this hostname if the requested hostname does not have its own directory - + simple-vhost.document-root path below the vhost directory diff --git a/doc/skeleton.txt b/doc/skeleton.txt index 13c6881..b1b01e6 100644 --- a/doc/skeleton.txt +++ b/doc/skeleton.txt @@ -12,10 +12,10 @@ Module: mod_skeleton :abstract: a nice, short abstrace about the module - + .. meta:: :keywords: lighttpd, skeleton - + .. contents:: Table of Contents Description diff --git a/doc/spawn-php.sh b/doc/spawn-php.sh index 83b7b16..181eae2 100755 --- a/doc/spawn-php.sh +++ b/doc/spawn-php.sh @@ -49,6 +49,6 @@ E= for i in $ALLOWED_ENV; do E="$E $i=${!i}" done - + # clean the environment and set up a new one env - $E $EX diff --git a/doc/ssi.txt b/doc/ssi.txt index 8761416..c65e7e1 100644 --- a/doc/ssi.txt +++ b/doc/ssi.txt @@ -13,10 +13,10 @@ Module: mod_ssi :abstract: The module for server-side includes provides a compatability layer for NSCA/Apache SSI. - + .. meta:: :keywords: lighttpd, ssi, Server-Side Includes - + .. contents:: Table of Contents Description @@ -73,4 +73,4 @@ which are not supported by this module for various reasons: - nested virtual - config.errmsg - echo.encoding - + diff --git a/doc/state.txt b/doc/state.txt index d0768bc..5e8277b 100644 --- a/doc/state.txt +++ b/doc/state.txt @@ -14,10 +14,10 @@ Module: core This is a short summary of the state-engine which is driving the lighttpd webserver. It describes the basic concepts and the way the different parts of the server are connected. - + .. meta:: :keywords: lighttpd, state-engine - + .. contents:: Table of Contents Description @@ -52,72 +52,72 @@ and some may never be hit at all. reset connection (incl. close()) :close: close connection (handle lingering close) - + .. image:: state.png - + A simple GET request (green path) --------------------------------- - + The connection is idling in the 'connect' state waiting for a connection. As soon as the connection is set up we init the read-timer in 'reqstart' and start to read data from the network. As soon as we get the HTTP-request terminator (CRLFCRLF) we forward the header to the parser. - + The parsed request is handled by 'handlereq' and as soon as a decision out the request is made it is sent to 'respstart' to prepare the HTTP-response header. In the 'write' state the prepare content is sent out to the network. When everything is sent 'respend' is entered to log the -request and cleanup the environment. After the close() call the connection +request and cleanup the environment. After the close() call the connection is set back to the 'connect' state again. - + Keep-Alive (blue path) ---------------------- - + The Keep-Alive handling is implemented by going from the 'respend' directly to 'reqstart' without the close() and the accept() calls. - + POST requests (grey path) ------------------------- - + As requests might contain a request-body the state 'readpost' entered as soon as the header is parsed and we know how much data we expect. - + Pipelining ---------- - + HTTP/1.1 supportes pipelining (sending multiple requests without waiting for the response of the first request). This is handled transparently by the 'read' state. - + Unexpected errors (red path) ---------------------------- - + For really hard errors we use the 'error' state which resets the connection and can be call from every state. It is only use if there is no other way to handle the issue (e.g. client-side close of the connection). If possible we should use http-status 500 ('internal server error') and log the issue in the errorlog. - + If we have to take care of some data which is coming in after we ran into the error condition the 'close' state is used the init a half-close and read all the delay packet from the network. - + Sub-Requests (lightblue) ------------------------ - + The FastCGI, CGI, ... intergration is done by introducing a loop in 'handlereq' to handle all aspect which are neccesary to find out what has to be sent back to the client. - + Functions ========= Important functions used by the state-engine - + :state-engine: - ``connection_state_machine()`` - + :connect: - (nothing) diff --git a/doc/status.txt b/doc/status.txt index fe3ee87..5312176 100644 --- a/doc/status.txt +++ b/doc/status.txt @@ -12,10 +12,10 @@ Module: mod_status :abstract: mod_status displays the server's status and configuration - + .. meta:: :keywords: lighttpd, server status - + .. contents:: Table of Contents Description @@ -47,8 +47,8 @@ cover it in a conditional. :: } Or require authorization: :: - - auth.require = ( "/server-status" => + + auth.require = ( "/server-status" => ( "realm" ... ) ) @@ -68,7 +68,7 @@ status-url you can get a text version which is simpler to parse. :: Uptime: 1234 BusyServers: 123 -Total Accesses is the number of handled requests, kBytes the overall outgoing +Total Accesses is the number of handled requests, kBytes the overall outgoing traffic, Uptime the uptime in seconds and BusyServers the number of currently active connections. @@ -88,7 +88,7 @@ status.status-url Example: status.status-url = "/server-status" status.enable-sort - + add JavaScript which allows client-side sorting for the connection overview Default: enable diff --git a/doc/userdir.txt b/doc/userdir.txt index 10ba065..27a896a 100644 --- a/doc/userdir.txt +++ b/doc/userdir.txt @@ -11,11 +11,11 @@ Module: mod_userdir :Revision: $Revision: 1.1 $ :abstract: - The userdir module ... - + The userdir module ... + .. meta:: :keywords: lighttpd, userdir - + .. contents:: Table of Contents Description @@ -29,7 +29,7 @@ building the classic mapping of: :: userdir.path = "public_html" - URL: http://www.example.org/~jan/index.html + URL: http://www.example.org/~jan/index.html Path: /home/jan/public_html/ To control which users should be able to use this feature you can set a list of usernames to include or exclude. @@ -48,7 +48,7 @@ Options userdir.path usually it should be set to "public_html" to take ~/public_html/ as the document root - + Default: empty (document root is the home directory) Example: :: diff --git a/doc/webdav.txt b/doc/webdav.txt index b10012f..7b5259e 100644 --- a/doc/webdav.txt +++ b/doc/webdav.txt @@ -12,17 +12,17 @@ Module: mod_webdav :abstract: WebDAV module for lighttpd - + .. meta:: :keywords: lighttpd, webdav - + .. contents:: Table of Contents Description =========== The WebDAV module is a very minimalistic implementation of RFC 2518. -Minimalistic means that not all operations are implemented yet. +Minimalistic means that not all operations are implemented yet. So far we have @@ -32,7 +32,7 @@ So far we have * DELETE * PUT -and the usual GET, POST, HEAD from HTTP/1.1. +and the usual GET, POST, HEAD from HTTP/1.1. So far, mounting a WebDAV resource into Windows XP works and the basic litmus tests are passed. @@ -41,9 +41,9 @@ Options ======= webdav.activate - If you load the webdav module, the WebDAV functionality has to be + If you load the webdav module, the WebDAV functionality has to be enabled for the directories you want to provide to the user. - + Default: disable webdav.is-readonly diff --git a/lighttpd.spec b/lighttpd.spec index 30e77b9..193170b 100644 --- a/lighttpd.spec +++ b/lighttpd.spec @@ -1,13 +1,13 @@ Summary: A fast webserver with minimal memory-footprint (lighttpd) Name: lighttpd -Version: 1.4.12 +Version: 1.4.13 Release: 1 Source: http://jan.kneschke.de/projects/lighttpd/download/lighttpd-%version.tar.gz Packager: Jan Kneschke License: BSD Group: Networking/Daemons URL: http://jan.kneschke.de/projects/lighttpd/ -Requires: pcre >= 3.1 zlib +Requires: pcre >= 3.1 zlib BuildPrereq: libtool zlib-devel BuildRoot: %{_tmppath}/%{name}-root @@ -63,7 +63,7 @@ fi %files %defattr(-,root,root) -%doc doc/lighttpd.conf doc/lighttpd.user README INSTALL ChangeLog COPYING AUTHORS +%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 diff --git a/lighttpd.spec.in b/lighttpd.spec.in index 182297d..9436a83 100644 --- a/lighttpd.spec.in +++ b/lighttpd.spec.in @@ -7,7 +7,7 @@ Packager: Jan Kneschke License: BSD Group: Networking/Daemons URL: http://jan.kneschke.de/projects/lighttpd/ -Requires: pcre >= 3.1 zlib +Requires: pcre >= 3.1 zlib BuildPrereq: libtool zlib-devel BuildRoot: %{_tmppath}/%{name}-root @@ -63,7 +63,7 @@ fi %files %defattr(-,root,root) -%doc doc/lighttpd.conf doc/lighttpd.user README INSTALL ChangeLog COPYING AUTHORS +%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 diff --git a/openwrt/Makefile.in b/openwrt/Makefile.in index 8cd22be..2fba912 100644 --- a/openwrt/Makefile.in +++ b/openwrt/Makefile.in @@ -101,7 +101,6 @@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ -LUACONFIG = @LUACONFIG@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LIBS = @LUA_LIBS@ MAINT = @MAINT@ @@ -134,6 +133,7 @@ SQLITE_LIBS = @SQLITE_LIBS@ SSL_LIB = @SSL_LIB@ STRIP = @STRIP@ U = @U@ +UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CFLAGS = @XML_CFLAGS@ XML_LIBS = @XML_LIBS@ diff --git a/openwrt/control b/openwrt/control index ec80f98..d83440a 100644 --- a/openwrt/control +++ b/openwrt/control @@ -1,8 +1,8 @@ Package: lighttpd -Version: 1.4.12 +Version: 1.4.13 Architecture: mipsel Maintainer: Jan Kneschke -Source: http://jan.kneschke.de/projects/lighttpd/download/lighttpd-1.4.12.tar.gz +Source: http://jan.kneschke.de/projects/lighttpd/download/lighttpd-1.4.13.tar.gz Section: net Priority: optional Depends: diff --git a/openwrt/lighttpd.conf b/openwrt/lighttpd.conf index 42d2f76..b17519d 100644 --- a/openwrt/lighttpd.conf +++ b/openwrt/lighttpd.conf @@ -1,5 +1,5 @@ # lighttpd configuration file -# +# # use a it as base for lighttpd 1.0.0 and above # # $Id: lighttpd.conf,v 1.6 2004/08/29 09:44:53 weigon Exp $ @@ -11,12 +11,12 @@ # all other module should only be loaded if really neccesary # - saves some time # - saves memory -server.modules = ( -# "mod_rewrite", -# "mod_redirect", - "mod_access", -# "mod_auth", -# "mod_status", +server.modules = ( +# "mod_rewrite", +# "mod_redirect", + "mod_access", +# "mod_auth", +# "mod_status", # "mod_fastcgi", # "mod_simple_vhost", # "mod_evhost", @@ -25,10 +25,10 @@ server.modules = ( # "mod_ssi", # "mod_usertrack", # "mod_rrdtool", -# "mod_accesslog" +# "mod_accesslog" ) -## a static document-root, for virtual-hosting take look at the +## a static document-root, for virtual-hosting take look at the ## server.virtual-* options server.document-root = "/www/" @@ -36,11 +36,11 @@ server.document-root = "/www/" # server.errorlog = "" # files to check for if .../ is requested -server.indexfiles = ( "index.php", "index.html", +server.indexfiles = ( "index.php", "index.html", "index.htm", "default.htm" ) # mimetype mapping -mimetype.assign = ( +mimetype.assign = ( ".pdf" => "application/pdf", ".sig" => "application/pgp-signature", ".spl" => "application/futuresplash", @@ -131,7 +131,7 @@ url.access-deny = ( "~", ".inc" ) #simple-vhost.document-root = "/pages/" -## +## ## Format: .html ## -> ..../status-404.html for 'File not found' #server.errorfile-prefix = "/home/weigon/projects/lighttpd/doc/status-" @@ -160,8 +160,8 @@ url.access-deny = ( "~", ".inc" ) #### fastcgi module ## read fastcgi.txt for more info #fastcgi.server = ( ".php" => -# ( "grisu" => -# ( +# ( "grisu" => +# ( # "host" => "192.168.2.10", # "port" => 1026 # ) @@ -191,14 +191,14 @@ url.access-deny = ( "~", ".inc" ) # auth.backend.ldap.base-dn = "dc=my-domain,dc=com" # auth.backend.ldap.filter = "(uid=$)" -# auth.require = ( "/server-status" => -# ( +# auth.require = ( "/server-status" => +# ( # "method" => "digest", # "realm" => "download archiv", # "require" => "group=www|user=jan|host=192.168.2.10" # ), -# "/server-info" => -# ( +# "/server-info" => +# ( # "method" => "digest", # "realm" => "download archiv", # "require" => "group=www|user=jan|host=192.168.2.10" diff --git a/openwrt/lighttpd.mk b/openwrt/lighttpd.mk index e198e3f..c4bf1de 100644 --- a/openwrt/lighttpd.mk +++ b/openwrt/lighttpd.mk @@ -10,7 +10,7 @@ # For this example we'll use a fairly simple package that compiles easily # and has sources available for download at sourceforge -LIGHTTPD=lighttpd-1.4.12 +LIGHTTPD=lighttpd-1.4.13 LIGHTTPD_TARGET=.built LIGHTTPD_DIR=$(BUILD_DIR)/$(LIGHTTPD) LIGHTTPD_IPK=$(BUILD_DIR)/$(LIGHTTPD)_mipsel.ipk @@ -28,7 +28,7 @@ $(DL_DIR)/$(LIGHTTPD_SOURCE) : $(LIGHTTPD_DIR)/.unpacked: $(DL_DIR)/$(LIGHTTPD_SOURCE) gzip -cd $(DL_DIR)/$(LIGHTTPD_SOURCE) | tar -C $(BUILD_DIR) -xvf - touch $(LIGHTTPD_DIR)/.unpacked - + # if we have the sources unpacked, we need to configure them $(LIGHTTPD_DIR)/.configured: $(LIGHTTPD_DIR)/.unpacked (cd $(LIGHTTPD_DIR); rm -rf config.cache; \ @@ -48,14 +48,14 @@ $(LIGHTTPD_DIR)/.configured: $(LIGHTTPD_DIR)/.unpacked --program-transform-name="s,y,y," \ ); touch $(LIGHTTPD_DIR)/.configured - - + + # now that we have it all in place, just build it $(LIGHTTPD_DIR)/$(LIGHTTPD_TARGET): $(LIGHTTPD_DIR)/.configured - cd $(LIGHTTPD_DIR) && $(MAKE) CC=$(TARGET_CC) DESTDIR="$(LIGHTTPD_IPK_DIR)" install + cd $(LIGHTTPD_DIR) && $(MAKE) CC=$(TARGET_CC) DESTDIR="$(LIGHTTPD_IPK_DIR)" install $(STAGING_DIR)/bin/sstrip $(LIGHTTPD_IPK_DIR)/usr/sbin/lighttpd touch $(LIGHTTPD_DIR)/$(LIGHTTPD_TARGET) - + $(LIGHTTPD_IPK): uclibc $(LIGHTTPD_DIR)/$(LIGHTTPD_TARGET) mkdir -p $(LIGHTTPD_IPK_DIR)/CONTROL mkdir -p $(LIGHTTPD_IPK_DIR)/etc/init.d diff --git a/openwrt/lighttpd.mk.in b/openwrt/lighttpd.mk.in index 9ee6170..85cd2f2 100644 --- a/openwrt/lighttpd.mk.in +++ b/openwrt/lighttpd.mk.in @@ -28,7 +28,7 @@ $(DL_DIR)/$(LIGHTTPD_SOURCE) : $(LIGHTTPD_DIR)/.unpacked: $(DL_DIR)/$(LIGHTTPD_SOURCE) gzip -cd $(DL_DIR)/$(LIGHTTPD_SOURCE) | tar -C $(BUILD_DIR) -xvf - touch $(LIGHTTPD_DIR)/.unpacked - + # if we have the sources unpacked, we need to configure them $(LIGHTTPD_DIR)/.configured: $(LIGHTTPD_DIR)/.unpacked (cd $(LIGHTTPD_DIR); rm -rf config.cache; \ @@ -48,14 +48,14 @@ $(LIGHTTPD_DIR)/.configured: $(LIGHTTPD_DIR)/.unpacked --program-transform-name="s,y,y," \ ); touch $(LIGHTTPD_DIR)/.configured - - + + # now that we have it all in place, just build it $(LIGHTTPD_DIR)/$(LIGHTTPD_TARGET): $(LIGHTTPD_DIR)/.configured - cd $(LIGHTTPD_DIR) && $(MAKE) CC=$(TARGET_CC) DESTDIR="$(LIGHTTPD_IPK_DIR)" install + cd $(LIGHTTPD_DIR) && $(MAKE) CC=$(TARGET_CC) DESTDIR="$(LIGHTTPD_IPK_DIR)" install $(STAGING_DIR)/bin/sstrip $(LIGHTTPD_IPK_DIR)/usr/sbin/lighttpd touch $(LIGHTTPD_DIR)/$(LIGHTTPD_TARGET) - + $(LIGHTTPD_IPK): uclibc $(LIGHTTPD_DIR)/$(LIGHTTPD_TARGET) mkdir -p $(LIGHTTPD_IPK_DIR)/CONTROL mkdir -p $(LIGHTTPD_IPK_DIR)/etc/init.d diff --git a/src/Makefile.am b/src/Makefile.am index 3381100..49b3bfd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ AM_CFLAGS = $(FAM_CFLAGS) noinst_PROGRAMS=proc_open lemon # simple-fcgi #graphic evalo bench ajp ssl error_test adserver gen-license -sbin_PROGRAMS=lighttpd +sbin_PROGRAMS=lighttpd bin_PROGRAMS=spawn-fcgi LEMON=$(top_builddir)/src/lemon @@ -11,8 +11,8 @@ lemon_SOURCES=lemon.c #simple_fcgi_LDADD=-lfcgi if CROSS_COMPILING -configparser.c configparser.h: -mod_ssi_exprparser.c mod_ssi_exprparser.h: +configparser.c configparser.h: +mod_ssi_exprparser.c mod_ssi_exprparser.h: else configparser.y: lemon mod_ssi_exprparser.y: lemon @@ -21,7 +21,7 @@ configparser.c configparser.h: configparser.y rm -f configparser.h $(LEMON) -q $(srcdir)/configparser.y $(srcdir)/lempar.c -mod_ssi_exprparser.c mod_ssi_exprparser.h: mod_ssi_exprparser.y +mod_ssi_exprparser.c mod_ssi_exprparser.h: mod_ssi_exprparser.y rm -f mod_ssi_exprparser.h $(LEMON) -q $(srcdir)/mod_ssi_exprparser.y $(srcdir)/lempar.c endif @@ -47,13 +47,13 @@ common_src=buffer.c log.c \ network_freebsd_sendfile.c network_writev.c \ network_solaris_sendfilev.c network_openssl.c \ splaytree.c status_counter.c - + src = server.c response.c connections.c network.c \ configfile.c configparser.c request.c proc_open.c spawn_fcgi_SOURCES=spawn-fcgi.c -lib_LTLIBRARIES = +lib_LTLIBRARIES = if NO_RDYNAMIC # if the linker doesn't allow referencing symbols of the binary @@ -67,11 +67,11 @@ liblightcomp_la_LIBADD = $(PCRE_LIB) $(SSL_LIB) $(FAM_LIBS) common_libadd = liblightcomp.la else src += $(common_src) -common_libadd = +common_libadd = endif lib_LTLIBRARIES += mod_flv_streaming.la -mod_flv_streaming_la_SOURCES = mod_flv_streaming.c +mod_flv_streaming_la_SOURCES = mod_flv_streaming.c mod_flv_streaming_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_flv_streaming_la_LIBADD = $(common_libadd) @@ -82,9 +82,9 @@ mod_evasive_la_LIBADD = $(common_libadd) lib_LTLIBRARIES += mod_webdav.la mod_webdav_la_SOURCES = mod_webdav.c -mod_webdav_la_CFLAGS = $(AM_CFLAGS) $(XML_CFLAGS) $(SQLITE_CFLAGS) +mod_webdav_la_CFLAGS = $(AM_CFLAGS) $(XML_CFLAGS) $(SQLITE_CFLAGS) mod_webdav_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined -mod_webdav_la_LIBADD = $(common_libadd) $(XML_LIBS) $(SQLITE_LIBS) +mod_webdav_la_LIBADD = $(common_libadd) $(XML_LIBS) $(SQLITE_LIBS) $(UUID_LIBS) lib_LTLIBRARIES += mod_magnet.la mod_magnet_la_SOURCES = mod_magnet.c mod_magnet_cache.c @@ -110,42 +110,42 @@ mod_mysql_vhost_la_LIBADD = $(MYSQL_LIBS) $(common_libadd) mod_mysql_vhost_la_CPPFLAGS = $(MYSQL_INCLUDE) lib_LTLIBRARIES += mod_cgi.la -mod_cgi_la_SOURCES = mod_cgi.c +mod_cgi_la_SOURCES = mod_cgi.c mod_cgi_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_cgi_la_LIBADD = $(common_libadd) lib_LTLIBRARIES += mod_scgi.la -mod_scgi_la_SOURCES = mod_scgi.c +mod_scgi_la_SOURCES = mod_scgi.c mod_scgi_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_scgi_la_LIBADD = $(common_libadd) lib_LTLIBRARIES += mod_staticfile.la -mod_staticfile_la_SOURCES = mod_staticfile.c +mod_staticfile_la_SOURCES = mod_staticfile.c mod_staticfile_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_staticfile_la_LIBADD = $(common_libadd) lib_LTLIBRARIES += mod_dirlisting.la -mod_dirlisting_la_SOURCES = mod_dirlisting.c +mod_dirlisting_la_SOURCES = mod_dirlisting.c mod_dirlisting_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_dirlisting_la_LIBADD = $(common_libadd) $(PCRE_LIB) lib_LTLIBRARIES += mod_indexfile.la -mod_indexfile_la_SOURCES = mod_indexfile.c +mod_indexfile_la_SOURCES = mod_indexfile.c mod_indexfile_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_indexfile_la_LIBADD = $(common_libadd) lib_LTLIBRARIES += mod_setenv.la -mod_setenv_la_SOURCES = mod_setenv.c +mod_setenv_la_SOURCES = mod_setenv.c mod_setenv_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_setenv_la_LIBADD = $(common_libadd) lib_LTLIBRARIES += mod_alias.la -mod_alias_la_SOURCES = mod_alias.c +mod_alias_la_SOURCES = mod_alias.c mod_alias_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_alias_la_LIBADD = $(common_libadd) lib_LTLIBRARIES += mod_userdir.la -mod_userdir_la_SOURCES = mod_userdir.c +mod_userdir_la_SOURCES = mod_userdir.c mod_userdir_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_userdir_la_LIBADD = $(common_libadd) @@ -165,7 +165,7 @@ mod_proxy_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_proxy_la_LIBADD = $(common_libadd) lib_LTLIBRARIES += mod_ssi.la -mod_ssi_la_SOURCES = mod_ssi_exprparser.c mod_ssi_expr.c mod_ssi.c +mod_ssi_la_SOURCES = mod_ssi_exprparser.c mod_ssi_expr.c mod_ssi.c mod_ssi_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_ssi_la_LIBADD = $(common_libadd) $(PCRE_LIB) @@ -193,7 +193,7 @@ lib_LTLIBRARIES += mod_simple_vhost.la mod_simple_vhost_la_SOURCES = mod_simple_vhost.c mod_simple_vhost_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_simple_vhost_la_LIBADD = $(common_libadd) - + lib_LTLIBRARIES += mod_fastcgi.la mod_fastcgi_la_SOURCES = mod_fastcgi.c mod_fastcgi_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined @@ -205,7 +205,7 @@ mod_access_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_access_la_LIBADD = $(common_libadd) lib_LTLIBRARIES += mod_compress.la -mod_compress_la_SOURCES = mod_compress.c +mod_compress_la_SOURCES = mod_compress.c mod_compress_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_compress_la_LIBADD = $(Z_LIB) $(BZ_LIB) $(common_libadd) diff --git a/src/Makefile.in b/src/Makefile.in index ff69c2a..e3ea4c1 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -221,7 +221,8 @@ mod_usertrack_la_DEPENDENCIES = $(am__DEPENDENCIES_2) am_mod_usertrack_la_OBJECTS = mod_usertrack.lo mod_usertrack_la_OBJECTS = $(am_mod_usertrack_la_OBJECTS) mod_webdav_la_DEPENDENCIES = $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) am_mod_webdav_la_OBJECTS = mod_webdav_la-mod_webdav.lo mod_webdav_la_OBJECTS = $(am_mod_webdav_la_OBJECTS) binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) @@ -384,7 +385,6 @@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ -LUACONFIG = @LUACONFIG@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LIBS = @LUA_LIBS@ MAINT = @MAINT@ @@ -417,6 +417,7 @@ SQLITE_LIBS = @SQLITE_LIBS@ SSL_LIB = @SSL_LIB@ STRIP = @STRIP@ U = @U@ +UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ XML_CFLAGS = @XML_CFLAGS@ XML_LIBS = @XML_LIBS@ @@ -514,16 +515,16 @@ lib_LTLIBRARIES = $(am__append_1) mod_flv_streaming.la mod_evasive.la \ @NO_RDYNAMIC_TRUE@liblightcomp_la_LIBADD = $(PCRE_LIB) $(SSL_LIB) $(FAM_LIBS) @NO_RDYNAMIC_FALSE@common_libadd = @NO_RDYNAMIC_TRUE@common_libadd = liblightcomp.la -mod_flv_streaming_la_SOURCES = mod_flv_streaming.c +mod_flv_streaming_la_SOURCES = mod_flv_streaming.c mod_flv_streaming_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_flv_streaming_la_LIBADD = $(common_libadd) mod_evasive_la_SOURCES = mod_evasive.c mod_evasive_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_evasive_la_LIBADD = $(common_libadd) mod_webdav_la_SOURCES = mod_webdav.c -mod_webdav_la_CFLAGS = $(AM_CFLAGS) $(XML_CFLAGS) $(SQLITE_CFLAGS) +mod_webdav_la_CFLAGS = $(AM_CFLAGS) $(XML_CFLAGS) $(SQLITE_CFLAGS) mod_webdav_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined -mod_webdav_la_LIBADD = $(common_libadd) $(XML_LIBS) $(SQLITE_LIBS) +mod_webdav_la_LIBADD = $(common_libadd) $(XML_LIBS) $(SQLITE_LIBS) $(UUID_LIBS) mod_magnet_la_SOURCES = mod_magnet.c mod_magnet_cache.c mod_magnet_la_CFLAGS = $(AM_CFLAGS) $(LUA_CFLAGS) mod_magnet_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined @@ -539,28 +540,28 @@ mod_mysql_vhost_la_SOURCES = mod_mysql_vhost.c mod_mysql_vhost_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_mysql_vhost_la_LIBADD = $(MYSQL_LIBS) $(common_libadd) mod_mysql_vhost_la_CPPFLAGS = $(MYSQL_INCLUDE) -mod_cgi_la_SOURCES = mod_cgi.c +mod_cgi_la_SOURCES = mod_cgi.c mod_cgi_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_cgi_la_LIBADD = $(common_libadd) -mod_scgi_la_SOURCES = mod_scgi.c +mod_scgi_la_SOURCES = mod_scgi.c mod_scgi_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_scgi_la_LIBADD = $(common_libadd) -mod_staticfile_la_SOURCES = mod_staticfile.c +mod_staticfile_la_SOURCES = mod_staticfile.c mod_staticfile_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_staticfile_la_LIBADD = $(common_libadd) -mod_dirlisting_la_SOURCES = mod_dirlisting.c +mod_dirlisting_la_SOURCES = mod_dirlisting.c mod_dirlisting_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_dirlisting_la_LIBADD = $(common_libadd) $(PCRE_LIB) -mod_indexfile_la_SOURCES = mod_indexfile.c +mod_indexfile_la_SOURCES = mod_indexfile.c mod_indexfile_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_indexfile_la_LIBADD = $(common_libadd) -mod_setenv_la_SOURCES = mod_setenv.c +mod_setenv_la_SOURCES = mod_setenv.c mod_setenv_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_setenv_la_LIBADD = $(common_libadd) -mod_alias_la_SOURCES = mod_alias.c +mod_alias_la_SOURCES = mod_alias.c mod_alias_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_alias_la_LIBADD = $(common_libadd) -mod_userdir_la_SOURCES = mod_userdir.c +mod_userdir_la_SOURCES = mod_userdir.c mod_userdir_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_userdir_la_LIBADD = $(common_libadd) mod_rrdtool_la_SOURCES = mod_rrdtool.c @@ -572,7 +573,7 @@ mod_usertrack_la_LIBADD = $(common_libadd) mod_proxy_la_SOURCES = mod_proxy.c mod_proxy_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_proxy_la_LIBADD = $(common_libadd) -mod_ssi_la_SOURCES = mod_ssi_exprparser.c mod_ssi_expr.c mod_ssi.c +mod_ssi_la_SOURCES = mod_ssi_exprparser.c mod_ssi_expr.c mod_ssi.c mod_ssi_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_ssi_la_LIBADD = $(common_libadd) $(PCRE_LIB) mod_secdownload_la_SOURCES = mod_secure_download.c @@ -593,7 +594,7 @@ mod_fastcgi_la_LIBADD = $(common_libadd) mod_access_la_SOURCES = mod_access.c mod_access_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_access_la_LIBADD = $(common_libadd) -mod_compress_la_SOURCES = mod_compress.c +mod_compress_la_SOURCES = mod_compress.c mod_compress_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined mod_compress_la_LIBADD = $(Z_LIB) $(BZ_LIB) $(common_libadd) mod_auth_la_SOURCES = mod_auth.c http_auth_digest.c http_auth.c @@ -1544,8 +1545,8 @@ uninstall-am: uninstall-binPROGRAMS uninstall-info-am \ #simple_fcgi_SOURCES=simple-fcgi.c #simple_fcgi_LDADD=-lfcgi -@CROSS_COMPILING_TRUE@configparser.c configparser.h: -@CROSS_COMPILING_TRUE@mod_ssi_exprparser.c mod_ssi_exprparser.h: +@CROSS_COMPILING_TRUE@configparser.c configparser.h: +@CROSS_COMPILING_TRUE@mod_ssi_exprparser.c mod_ssi_exprparser.h: @CROSS_COMPILING_FALSE@configparser.y: lemon @CROSS_COMPILING_FALSE@mod_ssi_exprparser.y: lemon @@ -1553,7 +1554,7 @@ uninstall-am: uninstall-binPROGRAMS uninstall-info-am \ @CROSS_COMPILING_FALSE@ rm -f configparser.h @CROSS_COMPILING_FALSE@ $(LEMON) -q $(srcdir)/configparser.y $(srcdir)/lempar.c -@CROSS_COMPILING_FALSE@mod_ssi_exprparser.c mod_ssi_exprparser.h: mod_ssi_exprparser.y +@CROSS_COMPILING_FALSE@mod_ssi_exprparser.c mod_ssi_exprparser.h: mod_ssi_exprparser.y @CROSS_COMPILING_FALSE@ rm -f mod_ssi_exprparser.h @CROSS_COMPILING_FALSE@ $(LEMON) -q $(srcdir)/mod_ssi_exprparser.y $(srcdir)/lempar.c diff --git a/src/array.c b/src/array.c index 3e1b32d..e35455b 100644 --- a/src/array.c +++ b/src/array.c @@ -11,12 +11,12 @@ array *array_init(void) { array *a; - + a = calloc(1, sizeof(*a)); assert(a); - + a->next_power_of_2 = 1; - + return a; } @@ -43,29 +43,29 @@ array *array_init_array(array *src) { void array_free(array *a) { size_t i; if (!a) return; - + if (!a->is_weakref) { for (i = 0; i < a->size; i++) { if (a->data[i]) a->data[i]->free(a->data[i]); } } - + if (a->data) free(a->data); if (a->sorted) free(a->sorted); - + free(a); } void array_reset(array *a) { size_t i; if (!a) return; - + if (!a->is_weakref) { for (i = 0; i < a->used; i++) { a->data[i]->reset(a->data[i]); } } - + a->used = 0; } @@ -84,20 +84,20 @@ data_unset *array_pop(array *a) { static int array_get_index(array *a, const char *key, size_t keylen, int *rndx) { int ndx = -1; int i, pos = 0; - + if (key == NULL) return -1; - + /* try to find the string */ for (i = pos = a->next_power_of_2 / 2; ; i >>= 1) { int cmp; - + if (pos < 0) { pos += i; } else if (pos >= (int)a->used) { pos -= i; } else { cmp = buffer_caseless_compare(key, keylen, a->data[a->sorted[pos]]->key->ptr, a->data[a->sorted[pos]]->key->used); - + if (cmp == 0) { /* found */ ndx = a->sorted[pos]; @@ -110,46 +110,46 @@ static int array_get_index(array *a, const char *key, size_t keylen, int *rndx) } if (i == 0) break; } - + if (rndx) *rndx = pos; - + return ndx; } data_unset *array_get_element(array *a, const char *key) { int ndx; - + if (-1 != (ndx = array_get_index(a, key, strlen(key) + 1, NULL))) { /* found, leave here */ - + return a->data[ndx]; - } - + } + return NULL; } data_unset *array_get_unused_element(array *a, data_type_t t) { data_unset *ds = NULL; - + UNUSED(t); if (a->size == 0) return NULL; - + if (a->used == a->size) return NULL; if (a->data[a->used]) { ds = a->data[a->used]; - + a->data[a->used] = NULL; } - + return ds; } /* replace or insert data, return the old one with the same key */ data_unset *array_replace(array *a, data_unset *du) { int ndx; - + if (-1 == (ndx = array_get_index(a, du->key->ptr, du->key->used, NULL))) { array_insert_unique(a, du); return NULL; @@ -164,13 +164,13 @@ int array_insert_unique(array *a, data_unset *str) { int ndx = -1; int pos = 0; size_t j; - + /* generate unique index if neccesary */ if (str->key->used == 0 || str->is_index_key) { buffer_copy_long(str->key, a->unique_ndx++); str->is_index_key = 1; } - + /* try to find the string */ if (-1 != (ndx = array_get_index(a, str->key->ptr, str->key->used, &pos))) { /* found, leave here */ @@ -181,14 +181,14 @@ int array_insert_unique(array *a, data_unset *str) { } return 0; } - + /* insert */ - + if (a->used+1 > INT_MAX) { /* we can't handle more then INT_MAX entries: see array_get_index() */ return -1; } - + if (a->size == 0) { a->size = 16; a->data = malloc(sizeof(*a->data) * a->size); @@ -204,27 +204,27 @@ int array_insert_unique(array *a, data_unset *str) { assert(a->sorted); for (j = a->used; j < a->size; j++) a->data[j] = NULL; } - + ndx = (int) a->used; - + a->data[a->used++] = str; - + if (pos != ndx && - ((pos < 0) || + ((pos < 0) || buffer_caseless_compare(str->key->ptr, str->key->used, a->data[a->sorted[pos]]->key->ptr, a->data[a->sorted[pos]]->key->used) > 0)) { pos++; - } - + } + /* move everything on step to the right */ if (pos != ndx) { memmove(a->sorted + (pos + 1), a->sorted + (pos), (ndx - pos) * sizeof(*a->sorted)); } - + /* insert */ a->sorted[pos] = ndx; - + if (a->next_power_of_2 == (size_t)ndx) a->next_power_of_2 <<= 1; - + return 0; } @@ -254,7 +254,7 @@ int array_print(array *a, int depth) { size_t i; size_t maxlen; int oneline = 1; - + if (a->used > 5) { oneline = 0; } @@ -314,7 +314,7 @@ int array_print(array *a, int depth) { } array_print_indent(depth); fprintf(stdout, ")"); - + return 0; } @@ -323,47 +323,47 @@ int main (int argc, char **argv) { array *a; data_string *ds; data_count *dc; - + UNUSED(argc); UNUSED(argv); a = array_init(); - + ds = data_string_init(); buffer_copy_string(ds->key, "abc"); buffer_copy_string(ds->value, "alfrag"); - + array_insert_unique(a, (data_unset *)ds); - + ds = data_string_init(); buffer_copy_string(ds->key, "abc"); buffer_copy_string(ds->value, "hameplman"); - + array_insert_unique(a, (data_unset *)ds); - + ds = data_string_init(); buffer_copy_string(ds->key, "123"); buffer_copy_string(ds->value, "alfrag"); - + array_insert_unique(a, (data_unset *)ds); - + dc = data_count_init(); buffer_copy_string(dc->key, "def"); - + array_insert_unique(a, (data_unset *)dc); - + dc = data_count_init(); buffer_copy_string(dc->key, "def"); - + array_insert_unique(a, (data_unset *)dc); - + array_print(a, 0); - + array_free(a); - + fprintf(stderr, "%d\n", buffer_caseless_compare(CONST_STR_LEN("Content-Type"), CONST_STR_LEN("Content-type"))); - + return 0; } #endif diff --git a/src/array.h b/src/array.h index b9687d7..862295c 100644 --- a/src/array.h +++ b/src/array.h @@ -29,21 +29,21 @@ typedef struct data_unset { typedef struct { data_unset **data; - + size_t *sorted; - + size_t used; size_t size; - + size_t unique_ndx; - + size_t next_power_of_2; int is_weakref; /* data is weakref, don't bother the data */ } array; typedef struct { DATA_UNSET; - + int count; } data_count; @@ -51,7 +51,7 @@ data_count *data_count_init(void); typedef struct { DATA_UNSET; - + buffer *value; } data_string; @@ -60,7 +60,7 @@ data_string *data_response_init(void); typedef struct { DATA_UNSET; - + array *value; } data_array; @@ -69,8 +69,8 @@ data_array *data_array_init(void); /** * possible compare ops in the configfile parser */ -typedef enum { - CONFIG_COND_UNSET, +typedef enum { + CONFIG_COND_UNSET, CONFIG_COND_EQ, /** == */ CONFIG_COND_MATCH, /** =~ */ CONFIG_COND_NE, /** != */ @@ -82,17 +82,17 @@ typedef enum { */ typedef enum { COMP_UNSET, - COMP_SERVER_SOCKET, - COMP_HTTP_URL, - COMP_HTTP_HOST, - COMP_HTTP_REFERER, - COMP_HTTP_USERAGENT, - COMP_HTTP_COOKIE, + COMP_SERVER_SOCKET, + COMP_HTTP_URL, + COMP_HTTP_HOST, + COMP_HTTP_REFERER, + COMP_HTTP_USERAGENT, + COMP_HTTP_COOKIE, COMP_HTTP_REMOTEIP, COMP_HTTP_QUERYSTRING } comp_key_t; -/* $HTTP["host"] == "incremental.home.kneschke.de" { ... } +/* $HTTP["host"] == "incremental.home.kneschke.de" { ... } * for print: comp_key op string * for compare: comp cond string/regex */ @@ -100,15 +100,15 @@ typedef enum { typedef struct _data_config data_config; struct _data_config { DATA_UNSET; - + array *value; - + buffer *comp_key; comp_key_t comp; - + config_cond_t cond; buffer *op; - + int context_ndx; /* more or less like an id */ array *childs; /* nested */ @@ -116,7 +116,7 @@ struct _data_config { /* for chaining only */ data_config *prev; data_config *next; - + buffer *string; #ifdef HAVE_PCRE_H pcre *regex; @@ -128,7 +128,7 @@ data_config *data_config_init(void); typedef struct { DATA_UNSET; - + int value; } data_integer; @@ -138,13 +138,13 @@ typedef struct { DATA_UNSET; buffer *host; - + unsigned short port; time_t disable_ts; int is_disabled; size_t balance; - + int usage; /* fair-balancing needs the no. of connections active on this host */ int last_used_ndx; /* round robin */ } data_fastcgi; diff --git a/src/base.h b/src/base.h index 15caee0..d70fad0 100644 --- a/src/base.h +++ b/src/base.h @@ -29,7 +29,7 @@ #if defined HAVE_LIBSSL && defined HAVE_OPENSSL_SSL_H # define USE_OPENSSL -# include +# include #endif #ifdef HAVE_FAM_H @@ -80,25 +80,25 @@ typedef int socklen_t; #include "settings.h" -typedef enum { T_CONFIG_UNSET, - T_CONFIG_STRING, - T_CONFIG_SHORT, - T_CONFIG_BOOLEAN, - T_CONFIG_ARRAY, - T_CONFIG_LOCAL, +typedef enum { T_CONFIG_UNSET, + T_CONFIG_STRING, + T_CONFIG_SHORT, + T_CONFIG_BOOLEAN, + T_CONFIG_ARRAY, + T_CONFIG_LOCAL, T_CONFIG_DEPRECATED, T_CONFIG_UNSUPPORTED } config_values_type_t; -typedef enum { T_CONFIG_SCOPE_UNSET, - T_CONFIG_SCOPE_SERVER, +typedef enum { T_CONFIG_SCOPE_UNSET, + T_CONFIG_SCOPE_SERVER, T_CONFIG_SCOPE_CONNECTION } config_scope_type_t; typedef struct { const char *key; void *destination; - + config_values_type_t type; config_scope_type_t scope; } config_values_t; @@ -143,29 +143,29 @@ typedef struct { /* the request-line */ buffer *request; buffer *uri; - + buffer *orig_uri; - + http_method_t http_method; http_version_t http_version; - + buffer *request_line; - + /* strings to the header */ buffer *http_host; /* not alloced */ const char *http_range; const char *http_content_type; const char *http_if_modified_since; const char *http_if_none_match; - + array *headers; - + /* CONTENT */ size_t content_length; /* returned by strtoul() */ - + /* internal representation */ int accept_encoding; - + /* internal */ buffer *pathinfo; } request; @@ -173,10 +173,10 @@ typedef struct { typedef struct { off_t content_length; int keep_alive; /* used by the subrequests in proxy, cgi and fcgi to say the subrequest was keep-alive or not */ - + array *headers; - - enum { + + enum { HTTP_TRANSFER_ENCODING_IDENTITY, HTTP_TRANSFER_ENCODING_CHUNKED } transfer_encoding; } response; @@ -192,21 +192,21 @@ typedef struct { typedef struct { buffer *path; buffer *basedir; /* path = "(basedir)(.*)" */ - + buffer *doc_root; /* path = doc_root + rel_path */ buffer *rel_path; - + buffer *etag; } physical; typedef struct { buffer *name; buffer *etag; - + struct stat st; - + time_t stat_ts; - + #ifdef HAVE_LSTAT char is_symlink; #endif @@ -221,7 +221,7 @@ typedef struct { typedef struct { splay_tree *files; /* the nodes of the tree are stat_cache_entry's */ - + buffer *dir_name; /* for building the dirname from the filename */ #ifdef HAVE_FAM_H splay_tree *dirs; /* the nodes of the tree are fam_dir_entry */ @@ -234,7 +234,7 @@ typedef struct { typedef struct { array *mimetypes; - + /* virtual-servers */ buffer *document_root; buffer *server_name; @@ -242,7 +242,7 @@ typedef struct { buffer *server_tag; buffer *dirlist_encoding; buffer *errorfile_prefix; - + unsigned short max_keep_alive_requests; unsigned short max_keep_alive_idle; unsigned short max_read_idle; @@ -250,16 +250,16 @@ typedef struct { unsigned short use_xattr; unsigned short follow_symlink; unsigned short range_requests; - + /* debug */ - + unsigned short log_file_not_found; unsigned short log_request_header; unsigned short log_request_handling; unsigned short log_response_header; unsigned short log_condition_handling; - - + + /* server wide */ buffer *ssl_pemfile; buffer *ssl_ca_file; @@ -277,9 +277,9 @@ typedef struct { /* configside */ unsigned short global_kbytes_per_second; /* */ - off_t global_bytes_per_second_cnt; + off_t global_bytes_per_second_cnt; /* server-wide traffic-shaper - * + * * each context has the counter which is inited once * a second by the global_kbytes_per_second config-var * @@ -287,12 +287,12 @@ typedef struct { * the connected conns are "offline" a little bit * * the problem: - * we somehow have to loose our "we are writable" signal + * we somehow have to loose our "we are writable" signal * on the way. - * + * */ off_t *global_bytes_per_second_cnt_ptr; /* */ - + #ifdef USE_OPENSSL SSL_CTX *ssl_ctx; #endif @@ -300,18 +300,18 @@ typedef struct { /* the order of the items should be the same as they are processed * read before write as we use this later */ -typedef enum { - CON_STATE_CONNECT, - CON_STATE_REQUEST_START, - CON_STATE_READ, - CON_STATE_REQUEST_END, - CON_STATE_READ_POST, - CON_STATE_HANDLE_REQUEST, - CON_STATE_RESPONSE_START, - CON_STATE_WRITE, - CON_STATE_RESPONSE_END, - CON_STATE_ERROR, - CON_STATE_CLOSE +typedef enum { + CON_STATE_CONNECT, + CON_STATE_REQUEST_START, + CON_STATE_READ, + CON_STATE_REQUEST_END, + CON_STATE_READ_POST, + CON_STATE_HANDLE_REQUEST, + CON_STATE_RESPONSE_START, + CON_STATE_WRITE, + CON_STATE_RESPONSE_END, + CON_STATE_ERROR, + CON_STATE_CLOSE } connection_state_t; typedef enum { COND_RESULT_UNSET, COND_RESULT_FALSE, COND_RESULT_TRUE } cond_result_t; @@ -324,88 +324,88 @@ typedef struct { typedef struct { connection_state_t state; - + /* timestamps */ time_t read_idle_ts; time_t close_timeout_ts; time_t write_request_ts; - + time_t connection_start; time_t request_start; - + struct timeval start_tv; - + size_t request_count; /* number of requests handled in this connection */ size_t loops_per_request; /* to catch endless loops in a single request - * + * * used by mod_rewrite, mod_fastcgi, ... and others * this is self-protection */ - + int fd; /* the FD for this connection */ int fde_ndx; /* index for the fdevent-handler */ int ndx; /* reverse mapping to server->connection[ndx] */ - + /* fd states */ int is_readable; int is_writable; - + int keep_alive; /* only request.c can enable it, all other just disable */ - + int file_started; int file_finished; - + chunkqueue *write_queue; /* a large queue for low-level write ( HTTP response ) [ file, mem ] */ chunkqueue *read_queue; /* a small queue for low-level read ( HTTP request ) [ mem ] */ chunkqueue *request_content_queue; /* takes request-content into tempfile if necessary [ tempfile, mem ]*/ - + int traffic_limit_reached; - + off_t bytes_written; /* used by mod_accesslog, mod_rrd */ off_t bytes_written_cur_second; /* used by mod_accesslog, mod_rrd */ off_t bytes_read; /* used by mod_accesslog, mod_rrd */ off_t bytes_header; - + int http_status; - + sock_addr dst_addr; buffer *dst_addr_buf; /* request */ buffer *parse_request; unsigned int parsed_response; /* bitfield which contains the important header-fields of the parsed response header */ - + request request; request_uri uri; - physical physical; + physical physical; response response; - + size_t header_len; - + buffer *authed_user; array *environment; /* used to pass lighttpd internal stuff to the FastCGI/CGI apps, setenv does that */ - + /* response */ int got_response; - + int in_joblist; - + connection_type mode; - + void **plugin_ctx; /* plugin connection specific config */ - + specific_config conf; /* global connection specific config */ cond_cache_t *cond_cache; - + buffer *server_name; - + /* error-handler */ buffer *error_handler; int error_handler_saved_status; int in_error_handler; - + void *srv_socket; /* reference to the server-socket (typecast to server_socket) */ - + #ifdef USE_OPENSSL SSL *ssl; buffer *ssl_error_want_reuse_buffer; @@ -452,36 +452,36 @@ typedef struct { typedef struct { unsigned short port; buffer *bindhost; - + buffer *errorlog_file; unsigned short errorlog_use_syslog; - + unsigned short dont_daemonize; buffer *changeroot; buffer *username; buffer *groupname; - + buffer *pid_file; - + buffer *event_handler; - + buffer *modules_dir; buffer *network_backend; array *modules; array *upload_tempdirs; - + unsigned short max_worker; unsigned short max_fds; unsigned short max_conns; unsigned short max_request_size; - + unsigned short log_request_header_on_error; unsigned short log_state_handling; - - enum { STAT_CACHE_ENGINE_UNSET, - STAT_CACHE_ENGINE_NONE, - STAT_CACHE_ENGINE_SIMPLE, - STAT_CACHE_ENGINE_FAM + + enum { STAT_CACHE_ENGINE_UNSET, + STAT_CACHE_ENGINE_NONE, + STAT_CACHE_ENGINE_SIMPLE, + STAT_CACHE_ENGINE_FAM } stat_cache_engine; unsigned short enable_cores; } server_config; @@ -490,16 +490,16 @@ typedef struct { sock_addr addr; int fd; int fde_ndx; - + buffer *ssl_pemfile; buffer *ssl_ca_file; buffer *ssl_cipher_list; unsigned short ssl_use_sslv2; unsigned short use_ipv6; unsigned short is_ssl; - + buffer *srv_token; - + #ifdef USE_OPENSSL SSL_CTX *ssl_ctx; #endif @@ -507,37 +507,37 @@ typedef struct { typedef struct { server_socket **ptr; - + size_t size; size_t used; } server_socket_array; typedef struct server { server_socket_array srv_sockets; - + /* the errorlog */ int errorlog_fd; enum { ERRORLOG_STDERR, ERRORLOG_FILE, ERRORLOG_SYSLOG } errorlog_mode; buffer *errorlog_buf; - + fdevents *ev, *ev_ins; - + buffer_plugin plugins; void *plugin_slots; - + /* counters */ int con_opened; int con_read; int con_written; int con_closed; - + int ssl_is_init; - + int max_fds; /* max possible fds */ int cur_fds; /* currently used fds */ int want_fds; /* waiting fds */ int sockets_disabled; - + size_t max_conns; /* buffers */ @@ -545,13 +545,13 @@ typedef struct server { buffer *response_header; buffer *response_range; buffer *tmp_buf; - + buffer *tmp_chunk_len; - + buffer *empty_string; /* is necessary for cond_match */ buffer *cond_check_buf; - + /* caches */ #ifdef HAVE_IPV6 inet_ntop_cache_type inet_ntop_cache[INET_NTOP_CACHE_MAX]; @@ -559,32 +559,32 @@ typedef struct server { mtime_cache_type mtime_cache[FILE_CACHE_MAX]; array *split_vals; - + /* Timestamps */ time_t cur_ts; time_t last_generated_date_ts; time_t last_generated_debug_ts; time_t startup_ts; - + buffer *ts_debug_str; buffer *ts_date_str; - + /* config-file */ array *config; array *config_touched; - + array *config_context; specific_config **config_storage; - + server_config srvconf; - + short int config_deprecated; short int config_unsupported; - + connections *conns; connections *joblist; connections *fdwaitqueue; - + stat_cache *stat_cache; /** @@ -601,7 +601,7 @@ typedef struct server { * fastcgi.backend..disconnects = ... */ array *status; - + fdevent_handler_t event_handler; int (* network_backend_write)(struct server *srv, connection *con, int fd, chunkqueue *cq); diff --git a/src/buffer.c b/src/buffer.c index 2026738..cf25d5b 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -12,20 +12,20 @@ static const char hex_chars[] = "0123456789abcdef"; /** - * init the buffer - * + * init the buffer + * */ buffer* buffer_init(void) { buffer *b; - + b = malloc(sizeof(*b)); assert(b); - + b->ptr = NULL; b->size = 0; b->used = 0; - + return b; } @@ -36,8 +36,8 @@ buffer *buffer_init_buffer(buffer *src) { } /** - * free the buffer - * + * free the buffer + * */ void buffer_free(buffer *b) { @@ -49,39 +49,39 @@ void buffer_free(buffer *b) { void buffer_reset(buffer *b) { if (!b) return; - + /* limit don't reuse buffer larger than ... bytes */ if (b->size > BUFFER_MAX_REUSE_SIZE) { free(b->ptr); b->ptr = NULL; b->size = 0; } - + b->used = 0; } /** - * - * allocate (if neccessary) enough space for 'size' bytes and + * + * allocate (if neccessary) enough space for 'size' bytes and * set the 'used' counter to 0 - * + * */ #define BUFFER_PIECE_SIZE 64 int buffer_prepare_copy(buffer *b, size_t size) { if (!b) return -1; - - if ((0 == b->size) || + + if ((0 == b->size) || (size > b->size)) { if (b->size) free(b->ptr); - + b->size = size; - + /* always allocate a multiply of BUFFER_PIECE_SIZE */ b->size += BUFFER_PIECE_SIZE - (b->size % BUFFER_PIECE_SIZE); - + b->ptr = malloc(b->size); assert(b->ptr); } @@ -90,30 +90,30 @@ int buffer_prepare_copy(buffer *b, size_t size) { } /** - * + * * increase the internal buffer (if neccessary) to append another 'size' byte * ->used isn't changed - * + * */ int buffer_prepare_append(buffer *b, size_t size) { if (!b) return -1; - + if (0 == b->size) { b->size = size; - + /* always allocate a multiply of BUFFER_PIECE_SIZE */ b->size += BUFFER_PIECE_SIZE - (b->size % BUFFER_PIECE_SIZE); - + b->ptr = malloc(b->size); b->used = 0; assert(b->ptr); } else if (b->used + size > b->size) { b->size += size; - + /* always allocate a multiply of BUFFER_PIECE_SIZE */ b->size += BUFFER_PIECE_SIZE - (b->size % BUFFER_PIECE_SIZE); - + b->ptr = realloc(b->ptr, b->size); assert(b->ptr); } @@ -122,7 +122,7 @@ int buffer_prepare_append(buffer *b, size_t size) { int buffer_copy_string(buffer *b, const char *s) { size_t s_len; - + if (!s || !b) return -1; s_len = strlen(s) + 1; @@ -136,26 +136,26 @@ int buffer_copy_string(buffer *b, const char *s) { int buffer_copy_string_len(buffer *b, const char *s, size_t s_len) { if (!s || !b) return -1; -#if 0 - /* removed optimization as we have to keep the empty string +#if 0 + /* removed optimization as we have to keep the empty string * in some cases for the config handling - * + * * url.access-deny = ( "" ) */ if (s_len == 0) return 0; -#endif +#endif buffer_prepare_copy(b, s_len + 1); - + memcpy(b->ptr, s, s_len); b->ptr[s_len] = '\0'; b->used = s_len + 1; - + return 0; } int buffer_copy_string_buffer(buffer *b, const buffer *src) { if (!src) return -1; - + if (src->used == 0) { b->used = 0; return 0; @@ -201,10 +201,10 @@ int buffer_append_string_rfill(buffer *b, const char *s, size_t maxlen) { /** * append a string to the end of the buffer - * - * the resulting buffer is terminated with a '\0' + * + * the resulting buffer is terminated with a '\0' * s is treated as a un-terminated string (a \0 is handled a normal character) - * + * * @param b a buffer * @param s the string * @param s_len size of the string (without the terminating \0) @@ -228,7 +228,7 @@ int buffer_append_string_len(buffer *b, const char *s, size_t s_len) { int buffer_append_string_buffer(buffer *b, const buffer *src) { if (!src) return -1; if (src->used == 0) return 0; - + return buffer_append_string_len(b, src->ptr, src->used - 1); } @@ -245,9 +245,9 @@ int buffer_append_memory(buffer *b, const char *s, size_t s_len) { int buffer_copy_memory(buffer *b, const char *s, size_t s_len) { if (!s || !b) return -1; - + b->used = 0; - + return buffer_append_memory(b, s, s_len); } @@ -402,46 +402,46 @@ char hex2int(unsigned char hex) { /** - * init the buffer - * + * init the buffer + * */ buffer_array* buffer_array_init(void) { buffer_array *b; - + b = malloc(sizeof(*b)); - + assert(b); b->ptr = NULL; b->size = 0; b->used = 0; - + return b; } void buffer_array_reset(buffer_array *b) { size_t i; - + if (!b) return; - + /* if they are too large, reduce them */ for (i = 0; i < b->used; i++) { buffer_reset(b->ptr[i]); } - + b->used = 0; } /** - * free the buffer_array - * + * free the buffer_array + * */ void buffer_array_free(buffer_array *b) { size_t i; if (!b) return; - + for (i = 0; i < b->size; i++) { if (b->ptr[i]) buffer_free(b->ptr[i]); } @@ -451,7 +451,7 @@ void buffer_array_free(buffer_array *b) { buffer *buffer_array_append_get_buffer(buffer_array *b) { size_t i; - + if (b->size == 0) { b->size = 16; b->ptr = malloc(sizeof(*b->ptr) * b->size); @@ -467,13 +467,13 @@ buffer *buffer_array_append_get_buffer(buffer_array *b) { b->ptr[i] = NULL; } } - + if (b->ptr[b->used] == NULL) { b->ptr[b->used] = buffer_init(); } - + b->ptr[b->used]->used = 0; - + return b->ptr[b->used++]; } @@ -482,23 +482,23 @@ char * buffer_search_string_len(buffer *b, const char *needle, size_t len) { size_t i; if (len == 0) return NULL; if (needle == NULL) return NULL; - + if (b->used < len) return NULL; - + for(i = 0; i < b->used - len; i++) { if (0 == memcmp(b->ptr + i, needle, len)) { return b->ptr + i; } } - + return NULL; } buffer *buffer_init_string(const char *str) { buffer *b = buffer_init(); - + buffer_copy_string(b, str); - + return b; } @@ -508,7 +508,7 @@ int buffer_is_empty(buffer *b) { /** * check if two buffer contain the same data - * + * * HISTORY: this function was pretty much optimized, but didn't handled * alignment properly. */ @@ -522,100 +522,100 @@ int buffer_is_equal(buffer *a, buffer *b) { int buffer_is_equal_string(buffer *a, const char *s, size_t b_len) { buffer b; - + b.ptr = (char *)s; b.used = b_len + 1; - + return buffer_is_equal(a, &b); } /* simple-assumption: - * + * * most parts are equal and doing a case conversion needs time - * + * */ int buffer_caseless_compare(const char *a, size_t a_len, const char *b, size_t b_len) { size_t ndx = 0, max_ndx; size_t *al, *bl; size_t mask = sizeof(*al) - 1; - + al = (size_t *)a; bl = (size_t *)b; - + /* is the alignment correct ? */ if ( ((size_t)al & mask) == 0 && ((size_t)bl & mask) == 0 ) { - + max_ndx = ((a_len < b_len) ? a_len : b_len) & ~mask; - + for (; ndx < max_ndx; ndx += sizeof(*al)) { if (*al != *bl) break; al++; bl++; - + } - + } - + a = (char *)al; b = (char *)bl; - + max_ndx = ((a_len < b_len) ? a_len : b_len); - + for (; ndx < max_ndx; ndx++) { char a1 = *a++, b1 = *b++; - + if (a1 != b1) { if ((a1 >= 'A' && a1 <= 'Z') && (b1 >= 'a' && b1 <= 'z')) a1 |= 32; else if ((a1 >= 'a' && a1 <= 'z') && (b1 >= 'A' && b1 <= 'Z')) b1 |= 32; if ((a1 - b1) != 0) return (a1 - b1); - + } } - + return 0; } /** * check if the rightmost bytes of the string are equal. - * - * + * + * */ int buffer_is_equal_right_len(buffer *b1, buffer *b2, size_t len) { /* no, len -> equal */ if (len == 0) return 1; - + /* len > 0, but empty buffers -> not equal */ if (b1->used == 0 || b2->used == 0) return 0; - + /* buffers too small -> not equal */ if (b1->used - 1 < len || b1->used - 1 < len) return 0; - - if (0 == strncmp(b1->ptr + b1->used - 1 - len, + + if (0 == strncmp(b1->ptr + b1->used - 1 - len, b2->ptr + b2->used - 1 - len, len)) { return 1; } - + return 0; } int buffer_copy_string_hex(buffer *b, const char *in, size_t in_len) { size_t i; - + /* BO protection */ if (in_len * 2 < in_len) return -1; - + buffer_prepare_copy(b, in_len * 2 + 1); - + for (i = 0; i < in_len; i++) { b->ptr[b->used++] = hex_chars[(in[i] >> 4) & 0x0F]; b->ptr[b->used++] = hex_chars[in[i] & 0x0F]; } b->ptr[b->used++] = '\0'; - + return 0; } @@ -624,7 +624,7 @@ const char encoded_chars_rel_uri_part[] = { 0 1 2 3 4 5 6 7 8 9 A B C D E F */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 00 - 0F control chars */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 10 - 1F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 10 - 1F */ 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, /* 20 - 2F space " # $ % & ' + , / */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, /* 30 - 3F : ; = ? @ < > */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 40 - 4F */ @@ -646,7 +646,7 @@ const char encoded_chars_rel_uri[] = { 0 1 2 3 4 5 6 7 8 9 A B C D E F */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 00 - 0F control chars */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 10 - 1F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 10 - 1F */ 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, /* 20 - 2F space " # $ % & ' + , / */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, /* 30 - 3F : ; = ? @ < > */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 40 - 4F */ @@ -668,7 +668,7 @@ const char encoded_chars_html[] = { 0 1 2 3 4 5 6 7 8 9 A B C D E F */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 00 - 0F control chars */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 10 - 1F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 10 - 1F */ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 20 - 2F & */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, /* 30 - 3F < > */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 40 - 4F */ @@ -690,7 +690,7 @@ const char encoded_chars_minimal_xml[] = { 0 1 2 3 4 5 6 7 8 9 A B C D E F */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 00 - 0F control chars */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 10 - 1F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 10 - 1F */ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 20 - 2F & */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, /* 30 - 3F < > */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 40 - 4F */ @@ -712,12 +712,12 @@ const char encoded_chars_hex[] = { 0 1 2 3 4 5 6 7 8 9 A B C D E F */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 00 - 0F control chars */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 10 - 1F */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 20 - 2F */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 30 - 3F */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 40 - 4F */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 50 - 5F */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 60 - 6F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 10 - 1F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 20 - 2F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 30 - 3F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 40 - 4F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 50 - 5F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 60 - 6F */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70 - 7F */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 80 - 8F */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 90 - 9F */ @@ -734,13 +734,13 @@ int buffer_append_string_encoded(buffer *b, const char *s, size_t s_len, buffer_ unsigned char *ds, *d; size_t d_len, ndx; const char *map = NULL; - + if (!s || !b) return -1; - + if (b->ptr[b->used - 1] != '\0') { SEGFAULT(); } - + if (s_len == 0) return 0; switch(encoding) { @@ -764,7 +764,7 @@ int buffer_append_string_encoded(buffer *b, const char *s, size_t s_len, buffer_ } assert(map != NULL); - + /* count to-be-encoded-characters */ for (ds = (unsigned char *)s, d_len = 0, ndx = 0; ndx < s_len; ds++, ndx++) { if (map[*ds]) { @@ -787,9 +787,9 @@ int buffer_append_string_encoded(buffer *b, const char *s, size_t s_len, buffer_ d_len ++; } } - + buffer_prepare_append(b, d_len); - + for (ds = (unsigned char *)s, d = (unsigned char *)b->ptr + b->used - 1, d_len = 0, ndx = 0; ndx < s_len; ds++, ndx++) { if (map[*ds]) { switch(encoding) { @@ -820,9 +820,9 @@ int buffer_append_string_encoded(buffer *b, const char *s, size_t s_len, buffer_ } } - /* terminate buffer and calculate new length */ + /* terminate buffer and calculate new length */ b->ptr[b->used + d_len - 1] = '\0'; - + b->used += d_len; return 0; @@ -854,10 +854,10 @@ static int buffer_urldecode_internal(buffer *url, int is_query) { low = hex2int(*(src + 2)); if (low != 0xFF) { high = (high << 4) | low; - - /* map control-characters out */ + + /* map control-characters out */ if (high < 32 || high == 127) high = '_'; - + *dst = high; src += 2; } @@ -925,7 +925,7 @@ int buffer_path_simplify(buffer *dest, buffer *src) } walk = src->ptr; #endif - + while (*walk == ' ') { walk++; } @@ -991,7 +991,7 @@ int light_isdigit(int c) { int light_isxdigit(int c) { if (light_isdigit(c)) return 1; - + c |= 32; return (c >= 'a' && c <= 'f'); } @@ -1007,29 +1007,29 @@ int light_isalnum(int c) { int buffer_to_lower(buffer *b) { char *c; - + if (b->used == 0) return 0; - + for (c = b->ptr; *c; c++) { if (*c >= 'A' && *c <= 'Z') { *c |= 32; } } - + return 0; } int buffer_to_upper(buffer *b) { char *c; - + if (b->used == 0) return 0; - + for (c = b->ptr; *c; c++) { if (*c >= 'a' && *c <= 'z') { *c &= ~32; } } - + return 0; } diff --git a/src/buffer.h b/src/buffer.h index 3ca22e5..82a5f83 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -12,23 +12,23 @@ typedef struct { char *ptr; - + size_t used; size_t size; } buffer; typedef struct { buffer **ptr; - + size_t used; size_t size; } buffer_array; typedef struct { char *ptr; - + size_t offset; /* input-pointer */ - + size_t used; /* output-pointer */ size_t size; } read_buffer; @@ -43,7 +43,7 @@ buffer* buffer_init_buffer(buffer *b); buffer* buffer_init_string(const char *str); void buffer_free(buffer *b); void buffer_reset(buffer *b); - + int buffer_prepare_copy(buffer *b, size_t size); int buffer_prepare_append(buffer *b, size_t size); diff --git a/src/chunk.c b/src/chunk.c index 776d59e..f5ec564 100644 --- a/src/chunk.c +++ b/src/chunk.c @@ -1,7 +1,7 @@ /** * the network chunk-API - * - * + * + * */ #include @@ -20,34 +20,34 @@ chunkqueue *chunkqueue_init(void) { chunkqueue *cq; - + cq = calloc(1, sizeof(*cq)); - + cq->first = NULL; cq->last = NULL; - + cq->unused = NULL; - + return cq; } static chunk *chunk_init(void) { chunk *c; - + c = calloc(1, sizeof(*c)); - + c->mem = buffer_init(); c->file.name = buffer_init(); c->file.fd = -1; c->file.mmap.start = MAP_FAILED; c->next = NULL; - + return c; } static void chunk_free(chunk *c) { if (!c) return; - + buffer_free(c->mem); buffer_free(c->file.name); @@ -56,13 +56,13 @@ static void chunk_free(chunk *c) { static void chunk_reset(chunk *c) { if (!c) return; - + buffer_reset(c->mem); if (c->file.is_temp && !buffer_is_empty(c->file.name)) { unlink(c->file.name->ptr); } - + buffer_reset(c->file.name); if (c->file.fd != -1) { @@ -78,27 +78,27 @@ static void chunk_reset(chunk *c) { void chunkqueue_free(chunkqueue *cq) { chunk *c, *pc; - + if (!cq) return; - + for (c = cq->first; c; ) { pc = c; c = c->next; chunk_free(pc); } - + for (c = cq->unused; c; ) { pc = c; c = c->next; chunk_free(pc); } - + free(cq); } static chunk *chunkqueue_get_unused_chunk(chunkqueue *cq) { chunk *c; - + /* check if we have a unused chunk */ if (!cq->unused) { c = chunk_init(); @@ -109,18 +109,18 @@ static chunk *chunkqueue_get_unused_chunk(chunkqueue *cq) { c->next = NULL; cq->unused_chunks--; } - + return c; } static int chunkqueue_prepend_chunk(chunkqueue *cq, chunk *c) { c->next = cq->first; cq->first = c; - + if (cq->last == NULL) { cq->last = c; } - + return 0; } @@ -129,19 +129,19 @@ static int chunkqueue_append_chunk(chunkqueue *cq, chunk *c) { cq->last->next = c; } cq->last = c; - + if (cq->first == NULL) { cq->first = c; } - + return 0; } void chunkqueue_reset(chunkqueue *cq) { chunk *c; /* move everything to the unused queue */ - - /* mark all read written */ + + /* mark all read written */ for (c = cq->first; c; c = c->next) { switch(c->type) { case MEM_CHUNK: @@ -150,7 +150,7 @@ void chunkqueue_reset(chunkqueue *cq) { case FILE_CHUNK: c->offset = c->file.length; break; - default: + default: break; } } @@ -162,110 +162,110 @@ void chunkqueue_reset(chunkqueue *cq) { int chunkqueue_append_file(chunkqueue *cq, buffer *fn, off_t offset, off_t len) { chunk *c; - + if (len == 0) return 0; - + c = chunkqueue_get_unused_chunk(cq); - + c->type = FILE_CHUNK; - + buffer_copy_string_buffer(c->file.name, fn); c->file.start = offset; c->file.length = len; c->offset = 0; - + chunkqueue_append_chunk(cq, c); - + return 0; } int chunkqueue_append_buffer(chunkqueue *cq, buffer *mem) { chunk *c; - + if (mem->used == 0) return 0; - + c = chunkqueue_get_unused_chunk(cq); c->type = MEM_CHUNK; c->offset = 0; buffer_copy_string_buffer(c->mem, mem); - + chunkqueue_append_chunk(cq, c); - + return 0; } int chunkqueue_append_buffer_weak(chunkqueue *cq, buffer *mem) { chunk *c; - + if (mem->used == 0) return 0; - + c = chunkqueue_get_unused_chunk(cq); c->type = MEM_CHUNK; c->offset = 0; if (c->mem) buffer_free(c->mem); c->mem = mem; - + chunkqueue_append_chunk(cq, c); - + return 0; } int chunkqueue_prepend_buffer(chunkqueue *cq, buffer *mem) { chunk *c; - + if (mem->used == 0) return 0; - + c = chunkqueue_get_unused_chunk(cq); c->type = MEM_CHUNK; c->offset = 0; buffer_copy_string_buffer(c->mem, mem); - + chunkqueue_prepend_chunk(cq, c); - + return 0; } int chunkqueue_append_mem(chunkqueue *cq, const char * mem, size_t len) { chunk *c; - + if (len == 0) return 0; - + c = chunkqueue_get_unused_chunk(cq); c->type = MEM_CHUNK; c->offset = 0; buffer_copy_string_len(c->mem, mem, len - 1); - + chunkqueue_append_chunk(cq, c); - + return 0; } buffer * chunkqueue_get_prepend_buffer(chunkqueue *cq) { chunk *c; - + c = chunkqueue_get_unused_chunk(cq); - + c->type = MEM_CHUNK; c->offset = 0; buffer_reset(c->mem); - + chunkqueue_prepend_chunk(cq, c); - + return c->mem; } buffer *chunkqueue_get_append_buffer(chunkqueue *cq) { chunk *c; - + c = chunkqueue_get_unused_chunk(cq); - + c->type = MEM_CHUNK; c->offset = 0; buffer_reset(c->mem); - + chunkqueue_append_chunk(cq, c); - + return c->mem; } @@ -280,7 +280,7 @@ int chunkqueue_set_tempdirs(chunkqueue *cq, array *tempdirs) { chunk *chunkqueue_get_append_tempfile(chunkqueue *cq) { chunk *c; buffer *template = buffer_init_string("/var/tmp/lighttpd-upload-XXXXXX"); - + c = chunkqueue_get_unused_chunk(cq); c->type = FILE_CHUNK; @@ -290,7 +290,7 @@ chunk *chunkqueue_get_append_tempfile(chunkqueue *cq) { size_t i; /* we have several tempdirs, only if all of them fail we jump out */ - + for (i = 0; i < cq->tempdirs->used; i++) { data_string *ds = (data_string *)cq->tempdirs->data[i]; @@ -317,7 +317,7 @@ chunk *chunkqueue_get_append_tempfile(chunkqueue *cq) { chunkqueue_append_chunk(cq, c); buffer_free(template); - + return c; } @@ -325,7 +325,7 @@ chunk *chunkqueue_get_append_tempfile(chunkqueue *cq) { off_t chunkqueue_length(chunkqueue *cq) { off_t len = 0; chunk *c; - + for (c = cq->first; c; c = c->next) { switch (c->type) { case MEM_CHUNK: @@ -338,14 +338,14 @@ off_t chunkqueue_length(chunkqueue *cq) { break; } } - + return len; } off_t chunkqueue_written(chunkqueue *cq) { off_t len = 0; chunk *c; - + for (c = cq->first; c; c = c->next) { switch (c->type) { case MEM_CHUNK: @@ -356,7 +356,7 @@ off_t chunkqueue_written(chunkqueue *cq) { break; } } - + return len; } @@ -375,9 +375,9 @@ int chunkqueue_remove_finished_chunks(chunkqueue *cq) { if (c->mem->used == 0 || (c->offset == (off_t)c->mem->used - 1)) is_finished = 1; break; case FILE_CHUNK: - if (c->offset == c->file.length) is_finished = 1; + if (c->offset == c->file.length) is_finished = 1; break; - default: + default: break; } diff --git a/src/chunk.h b/src/chunk.h index 3893919..c3c91ab 100644 --- a/src/chunk.h +++ b/src/chunk.h @@ -6,7 +6,7 @@ typedef struct chunk { enum { UNUSED_CHUNK, MEM_CHUNK, FILE_CHUNK } type; - + buffer *mem; /* either the storage of the mem-chunk or the read-ahead buffer */ struct { @@ -16,7 +16,7 @@ typedef struct chunk { off_t length; /* octets to send from the starting offset */ int fd; - struct { + struct { char *start; /* the start pointer of the mmap'ed area */ size_t length; /* size of the mmap'ed area */ off_t offset; /* start is octet away from the start of the file */ @@ -24,20 +24,20 @@ typedef struct chunk { int is_temp; /* file is temporary and will be deleted if on cleanup */ } file; - - off_t offset; /* octets sent from this chunk - the size of the chunk is either + + off_t offset; /* octets sent from this chunk + the size of the chunk is either - mem-chunk: mem->used - 1 - file-chunk: file.length */ - + struct chunk *next; } chunk; typedef struct { chunk *first; chunk *last; - + chunk *unused; size_t unused_chunks; diff --git a/src/configfile-glue.c b/src/configfile-glue.c index 5d1c8ec..d783689 100644 --- a/src/configfile-glue.c +++ b/src/configfile-glue.c @@ -11,10 +11,10 @@ * are the external interface of lighttpd. The functions * are used by the server itself and the plugins. * - * The main-goal is to have a small library in the end - * which is linked against both and which will define + * The main-goal is to have a small library in the end + * which is linked against both and which will define * the interface itself in the end. - * + * */ @@ -24,56 +24,56 @@ int config_insert_values_internal(server *srv, array *ca, const config_values_t cv[]) { size_t i; data_unset *du; - + for (i = 0; cv[i].key; i++) { - + if (NULL == (du = array_get_element(ca, cv[i].key))) { /* no found */ - + continue; } - + switch (cv[i].type) { case T_CONFIG_ARRAY: if (du->type == TYPE_ARRAY) { size_t j; data_array *da = (data_array *)du; - + for (j = 0; j < da->value->used; j++) { if (da->value->data[j]->type == TYPE_STRING) { data_string *ds = data_string_init(); - + buffer_copy_string_buffer(ds->value, ((data_string *)(da->value->data[j]))->value); if (!da->is_index_key) { /* the id's were generated automaticly, as we copy now we might have to renumber them - * this is used to prepend server.modules by mod_indexfiles as it has to be loaded + * this is used to prepend server.modules by mod_indexfiles as it has to be loaded * before mod_fastcgi and friends */ buffer_copy_string_buffer(ds->key, ((data_string *)(da->value->data[j]))->key); } - + array_insert_unique(cv[i].destination, (data_unset *)ds); } else { - log_error_write(srv, __FILE__, __LINE__, "sssd", - "the key of an array can only be a string or a integer, variable:", - cv[i].key, "type:", da->value->data[j]->type); - + log_error_write(srv, __FILE__, __LINE__, "sssd", + "the key of an array can only be a string or a integer, variable:", + cv[i].key, "type:", da->value->data[j]->type); + return -1; } } } else { log_error_write(srv, __FILE__, __LINE__, "ss", cv[i].key, "should have been a array of strings like ... = ( \"...\" )"); - + return -1; } break; case T_CONFIG_STRING: if (du->type == TYPE_STRING) { data_string *ds = (data_string *)du; - + buffer_copy_string_buffer(cv[i].destination, ds->value); } else { log_error_write(srv, __FILE__, __LINE__, "ssss", cv[i].key, "should have been a string like ... = \"...\""); - + return -1; } break; @@ -81,15 +81,15 @@ int config_insert_values_internal(server *srv, array *ca, const config_values_t switch(du->type) { case TYPE_INTEGER: { data_integer *di = (data_integer *)du; - + *((unsigned short *)(cv[i].destination)) = di->value; break; } case TYPE_STRING: { data_string *ds = (data_string *)du; - + log_error_write(srv, __FILE__, __LINE__, "ssb", "got a string but expected a short:", cv[i].key, ds->value); - + return -1; } default: @@ -100,19 +100,19 @@ int config_insert_values_internal(server *srv, array *ca, const config_values_t case T_CONFIG_BOOLEAN: if (du->type == TYPE_STRING) { data_string *ds = (data_string *)du; - + if (buffer_is_equal_string(ds->value, CONST_STR_LEN("enable"))) { *((unsigned short *)(cv[i].destination)) = 1; } else if (buffer_is_equal_string(ds->value, CONST_STR_LEN("disable"))) { *((unsigned short *)(cv[i].destination)) = 0; } else { log_error_write(srv, __FILE__, __LINE__, "ssbs", "ERROR: unexpected value for key:", cv[i].key, ds->value, "(enable|disable)"); - + return -1; } } else { log_error_write(srv, __FILE__, __LINE__, "ssss", "ERROR: unexpected type for key:", cv[i].key, "(string)", "\"(enable|disable)\""); - + return -1; } break; @@ -121,15 +121,15 @@ int config_insert_values_internal(server *srv, array *ca, const config_values_t break; case T_CONFIG_UNSUPPORTED: log_error_write(srv, __FILE__, __LINE__, "ssss", "ERROR: found unsupported key:", cv[i].key, "-", (char *)(cv[i].destination)); - + srv->config_unsupported = 1; - + break; case T_CONFIG_DEPRECATED: log_error_write(srv, __FILE__, __LINE__, "ssss", "ERROR: found deprecated key:", cv[i].key, "-", (char *)(cv[i].destination)); - + srv->config_deprecated = 1; - + break; } } @@ -139,25 +139,25 @@ int config_insert_values_internal(server *srv, array *ca, const config_values_t int config_insert_values_global(server *srv, array *ca, const config_values_t cv[]) { size_t i; data_unset *du; - + for (i = 0; cv[i].key; i++) { data_string *touched; - + if (NULL == (du = array_get_element(ca, cv[i].key))) { /* no found */ - + continue; } - + /* touched */ touched = data_string_init(); - + buffer_copy_string(touched->value, ""); buffer_copy_string_buffer(touched->key, du->key); - + array_insert_unique(srv->config_touched, (data_unset *)touched); } - + return config_insert_values_internal(srv, ca, cv); } @@ -197,25 +197,25 @@ static cond_result_t config_check_cond_nocache(server *srv, connection *con, dat } /* pass the rules */ - + switch (dc->comp) { case COMP_HTTP_HOST: { char *ck_colon = NULL, *val_colon = NULL; - + if (!buffer_is_empty(con->uri.authority)) { - - /* + + /* * append server-port to the HTTP_POST if necessary */ - + l = con->uri.authority; - + switch(dc->cond) { case CONFIG_COND_NE: case CONFIG_COND_EQ: ck_colon = strchr(dc->string->ptr, ':'); val_colon = strchr(l->ptr, ':'); - + if (ck_colon == val_colon) { /* nothing to do with it */ break; @@ -242,15 +242,15 @@ static cond_result_t config_check_cond_nocache(server *srv, connection *con, dat } case COMP_HTTP_REMOTEIP: { char *nm_slash; - /* handle remoteip limitations - * + /* handle remoteip limitations + * * "10.0.0.1" is provided for all comparisions - * + * * only for == and != we support - * + * * "10.0.0.1/24" */ - + if ((dc->cond == CONFIG_COND_EQ || dc->cond == CONFIG_COND_NE) && (con->dst_addr.plain.sa_family == AF_INET) && @@ -259,41 +259,41 @@ static cond_result_t config_check_cond_nocache(server *srv, connection *con, dat long nm; char *err; struct in_addr val_inp; - + if (*(nm_slash+1) == '\0') { log_error_write(srv, __FILE__, __LINE__, "sb", "ERROR: no number after / ", dc->string); - + return COND_RESULT_FALSE; } - + nm_bits = strtol(nm_slash + 1, &err, 10); - + if (*err) { log_error_write(srv, __FILE__, __LINE__, "sbs", "ERROR: non-digit found in netmask:", dc->string, err); - + return COND_RESULT_FALSE; } - + /* take IP convert to the native */ buffer_copy_string_len(srv->cond_check_buf, dc->string->ptr, nm_slash - dc->string->ptr); -#ifdef __WIN32 +#ifdef __WIN32 if (INADDR_NONE == (val_inp.s_addr = inet_addr(srv->cond_check_buf->ptr))) { log_error_write(srv, __FILE__, __LINE__, "sb", "ERROR: ip addr is invalid:", srv->cond_check_buf); - + return COND_RESULT_FALSE; } #else if (0 == inet_aton(srv->cond_check_buf->ptr, &val_inp)) { log_error_write(srv, __FILE__, __LINE__, "sb", "ERROR: ip addr is invalid:", srv->cond_check_buf); - + return COND_RESULT_FALSE; } #endif - + /* build netmask */ nm = htonl(~((1 << (32 - nm_bits)) - 1)); - + if ((val_inp.s_addr & nm) == (con->dst_addr.ipv4.sin_addr.s_addr & nm)) { return (dc->cond == CONFIG_COND_EQ) ? COND_RESULT_TRUE : COND_RESULT_FALSE; } else { @@ -318,7 +318,7 @@ static cond_result_t config_check_cond_nocache(server *srv, connection *con, dat case COMP_HTTP_REFERER: { data_string *ds; - + if (NULL != (ds = (data_string *)array_get_element(con->request.headers, "Referer"))) { l = ds->value; } else { @@ -348,7 +348,7 @@ static cond_result_t config_check_cond_nocache(server *srv, connection *con, dat default: return COND_RESULT_FALSE; } - + if (NULL == l) { if (con->conf.log_condition_handling) { log_error_write(srv, __FILE__, __LINE__, "bsbs", dc->comp_key, @@ -356,7 +356,7 @@ static cond_result_t config_check_cond_nocache(server *srv, connection *con, dat } return COND_RESULT_FALSE; } - + if (con->conf.log_condition_handling) { log_error_write(srv, __FILE__, __LINE__, "bsbsb", dc->comp_key, "(", l, ") compare to ", dc->string); @@ -375,13 +375,13 @@ static cond_result_t config_check_cond_nocache(server *srv, connection *con, dat case CONFIG_COND_MATCH: { cond_cache_t *cache = &con->cond_cache[dc->context_ndx]; int n; - + #ifndef elementsof #define elementsof(x) (sizeof(x) / sizeof(x[0])) #endif n = pcre_exec(dc->regex, dc->regex_study, l->ptr, l->used - 1, 0, 0, cache->matches, elementsof(cache->matches)); - + cache->patterncount = n; if (n > 0) { cache->comp_value = l; @@ -397,7 +397,7 @@ static cond_result_t config_check_cond_nocache(server *srv, connection *con, dat /* no way */ break; } - + return COND_RESULT_FALSE; } @@ -440,7 +440,7 @@ void config_cond_cache_reset(server *srv, connection *con) { con->cond_cache[i].result = COND_RESULT_UNSET; con->cond_cache[i].patterncount = 0; } -#else +#else memset(con->cond_cache, 0, sizeof(cond_cache_t) * srv->config_context->used); #endif } diff --git a/src/configfile.c b/src/configfile.c index e5d1610..1d3d532 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -26,8 +26,8 @@ static int config_insert(server *srv) { size_t i; int ret = 0; buffer *stat_cache_string; - - config_values_t cv[] = { + + config_values_t cv[] = { { "server.bind", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 0 */ { "server.errorlog", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 1 */ { "server.errorfile-prefix", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 2 */ @@ -38,7 +38,7 @@ static int config_insert(server *srv) { { "server.tag", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 7 */ { "server.use-ipv6", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 8 */ { "server.modules", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_SERVER }, /* 9 */ - + { "server.event-handler", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 10 */ { "server.pid-file", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 11 */ { "server.max-request-size", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 12 */ @@ -49,7 +49,7 @@ static int config_insert(server *srv) { { "server.max-keep-alive-requests", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 17 */ { "server.name", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 18 */ { "server.max-keep-alive-idle", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 19 */ - + { "server.max-read-idle", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 20 */ { "server.max-write-idle", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 21 */ { "server.error-handler-404", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 22 */ @@ -67,19 +67,19 @@ static int config_insert(server *srv) { { "mimetype.use-xattr", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 27 */ { "mimetype.assign", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 28 */ { "ssl.pemfile", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 29 */ - + { "ssl.engine", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 30 */ - + { "debug.log-file-not-found", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 31 */ { "debug.log-request-handling", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 32 */ { "debug.log-response-header", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 33 */ { "debug.log-request-header", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 34 */ - + { "server.protocol-http11", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 35 */ { "debug.log-request-header-on-error", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 36 */ { "debug.log-state-handling", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 37 */ { "ssl.ca-file", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 38 */ - + { "server.errorlog-use-syslog", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 39 */ { "server.range-requests", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 40 */ { "server.stat-cache-engine", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 41 */ @@ -89,7 +89,7 @@ static int config_insert(server *srv) { { "server.core-files", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 45 */ { "ssl.cipher-list", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 46 */ { "ssl.use-sslv2", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 47 */ - + { "server.host", "use server.bind instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, { "server.docroot", "use server.document-root instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, { "server.virtual-root", "load mod_simple_vhost and use simple-vhost.server-root instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, @@ -99,11 +99,11 @@ static int config_insert(server *srv) { { "server.groupid", "use server.groupname instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, { "server.use-keep-alive", "use server.max-keep-alive-requests = 0 instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, { "server.force-lower-case-files", "use server.force-lowercase-filenames instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, - + { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET } }; - + /* 0 */ cv[0].destination = srv->srvconf.bindhost; cv[1].destination = srv->srvconf.errorlog_file; @@ -111,33 +111,33 @@ static int config_insert(server *srv) { cv[4].destination = srv->srvconf.username; cv[5].destination = srv->srvconf.groupname; cv[6].destination = &(srv->srvconf.port); - + cv[9].destination = srv->srvconf.modules; cv[10].destination = srv->srvconf.event_handler; cv[11].destination = srv->srvconf.pid_file; - + cv[13].destination = &(srv->srvconf.max_worker); cv[23].destination = &(srv->srvconf.max_fds); cv[36].destination = &(srv->srvconf.log_request_header_on_error); cv[37].destination = &(srv->srvconf.log_state_handling); - + cv[39].destination = &(srv->srvconf.errorlog_use_syslog); - + stat_cache_string = buffer_init(); cv[41].destination = stat_cache_string; cv[43].destination = srv->srvconf.network_backend; cv[44].destination = srv->srvconf.upload_tempdirs; cv[45].destination = &(srv->srvconf.enable_cores); - + cv[42].destination = &(srv->srvconf.max_conns); cv[12].destination = &(srv->srvconf.max_request_size); srv->config_storage = calloc(1, srv->config_context->used * sizeof(specific_config *)); assert(srv->config_storage); - + for (i = 0; i < srv->config_context->used; i++) { specific_config *s; - + s = calloc(1, sizeof(specific_config)); assert(s); s->document_root = buffer_init(); @@ -167,13 +167,13 @@ static int config_insert(server *srv) { s->global_kbytes_per_second = 0; s->global_bytes_per_second_cnt = 0; s->global_bytes_per_second_cnt_ptr = &s->global_bytes_per_second_cnt; - + cv[2].destination = s->errorfile_prefix; - + cv[7].destination = s->server_tag; cv[8].destination = &(s->use_ipv6); - - + + /* 13 max-worker */ cv[14].destination = s->document_root; cv[15].destination = &(s->force_lowercase_filenames); @@ -194,26 +194,26 @@ static int config_insert(server *srv) { cv[28].destination = s->mimetypes; cv[29].destination = s->ssl_pemfile; cv[30].destination = &(s->is_ssl); - + cv[31].destination = &(s->log_file_not_found); cv[32].destination = &(s->log_request_handling); cv[33].destination = &(s->log_response_header); cv[34].destination = &(s->log_request_header); - + cv[35].destination = &(s->allow_http11); cv[38].destination = s->ssl_ca_file; cv[40].destination = &(s->range_requests); - + cv[46].destination = s->ssl_cipher_list; cv[47].destination = &(s->ssl_use_sslv2); srv->config_storage[i] = s; - + if (0 != (ret = config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv))) { break; } } - + if (buffer_is_empty(stat_cache_string)) { srv->srvconf.stat_cache_engine = STAT_CACHE_ENGINE_SIMPLE; } else if (buffer_is_equal_string(stat_cache_string, CONST_STR_LEN("simple"))) { @@ -223,22 +223,22 @@ static int config_insert(server *srv) { } else if (buffer_is_equal_string(stat_cache_string, CONST_STR_LEN("disable"))) { srv->srvconf.stat_cache_engine = STAT_CACHE_ENGINE_NONE; } else { - log_error_write(srv, __FILE__, __LINE__, "sb", + log_error_write(srv, __FILE__, __LINE__, "sb", "server.stat-cache-engine can be one of \"disable\", \"simple\", \"fam\", but not:", stat_cache_string); ret = HANDLER_ERROR; } - + buffer_free(stat_cache_string); - + return ret; - + } #define PATCH(x) con->conf.x = s->x int config_setup_connection(server *srv, connection *con) { specific_config *s = srv->config_storage[0]; - + PATCH(allow_http11); PATCH(mimetypes); PATCH(document_root); @@ -256,20 +256,20 @@ int config_setup_connection(server *srv, connection *con) { PATCH(kbytes_per_second); PATCH(global_kbytes_per_second); PATCH(global_bytes_per_second_cnt); - + con->conf.global_bytes_per_second_cnt_ptr = &s->global_bytes_per_second_cnt; buffer_copy_string_buffer(con->server_name, s->server_name); - + PATCH(log_request_header); PATCH(log_response_header); PATCH(log_request_handling); PATCH(log_condition_handling); PATCH(log_file_not_found); - + PATCH(range_requests); PATCH(force_lowercase_filenames); PATCH(is_ssl); - + PATCH(ssl_pemfile); PATCH(ssl_ca_file); PATCH(ssl_cipher_list); @@ -281,22 +281,22 @@ int config_setup_connection(server *srv, connection *con) { int config_patch_connection(server *srv, connection *con, comp_key_t comp) { size_t i, j; - + /* skip the first, the global context */ for (i = 1; i < srv->config_context->used; i++) { 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; - + /* merge config */ for (j = 0; j < dc->value->used; j++) { data_unset *du = dc->value->data[j]; - + if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.document-root"))) { PATCH(document_root); } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.range-requests"))) { @@ -349,7 +349,7 @@ int config_patch_connection(server *srv, connection *con, comp_key_t comp) { PATCH(log_file_not_found); } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.protocol-http11"))) { PATCH(allow_http11); - } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.force-lowercase-filenames"))) { + } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.force-lowercase-filenames"))) { PATCH(force_lowercase_filenames); } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.kbytes-per-second"))) { PATCH(global_kbytes_per_second); @@ -358,7 +358,7 @@ int config_patch_connection(server *srv, connection *con, comp_key_t comp) { } } } - + return 0; } #undef PATCH @@ -366,15 +366,15 @@ int config_patch_connection(server *srv, connection *con, comp_key_t comp) { typedef struct { int foo; int bar; - + const buffer *source; const char *input; size_t offset; size_t size; - + int line_pos; int line; - + int in_key; int in_brace; int in_cond; @@ -392,7 +392,7 @@ static int tokenizer_open(server *srv, tokenizer_t *t, buffer *basedir, const ch } if (0 != stream_open(&(t->s), t->file)) { - log_error_write(srv, __FILE__, __LINE__, "sbss", + log_error_write(srv, __FILE__, __LINE__, "sbss", "opening configfile ", t->file, "failed:", strerror(errno)); buffer_free(t->file); return -1; @@ -403,7 +403,7 @@ static int tokenizer_open(server *srv, tokenizer_t *t, buffer *basedir, const ch t->size = t->s.size; t->line = 1; t->line_pos = 1; - + t->in_key = 1; t->in_brace = 0; t->in_cond = 0; @@ -431,7 +431,7 @@ static int config_skip_newline(tokenizer_t *t) { static int config_skip_comment(tokenizer_t *t) { int i; assert(t->input[t->offset] == '#'); - for (i = 1; t->input[t->offset + i] && + for (i = 1; t->input[t->offset + i] && (t->input[t->offset + i] != '\n' && t->input[t->offset + i] != '\r'); i++); t->offset += i; @@ -441,44 +441,44 @@ static int config_skip_comment(tokenizer_t *t) { static int config_tokenizer(server *srv, tokenizer_t *t, int *token_id, buffer *token) { int tid = 0; size_t i; - + for (tid = 0; tid == 0 && t->offset < t->size && t->input[t->offset] ; ) { char c = t->input[t->offset]; const char *start = NULL; - + switch (c) { - case '=': + case '=': if (t->in_brace) { if (t->input[t->offset + 1] == '>') { t->offset += 2; - + buffer_copy_string(token, "=>"); - + tid = TK_ARRAY_ASSIGN; } else { - log_error_write(srv, __FILE__, __LINE__, "sbsdsds", + log_error_write(srv, __FILE__, __LINE__, "sbsdsds", "source:", t->source, - "line:", t->line, "pos:", t->line_pos, + "line:", t->line, "pos:", t->line_pos, "use => for assignments in arrays"); return -1; } } else if (t->in_cond) { if (t->input[t->offset + 1] == '=') { t->offset += 2; - + buffer_copy_string(token, "=="); - + tid = TK_EQ; } else if (t->input[t->offset + 1] == '~') { t->offset += 2; - + buffer_copy_string(token, "=~"); - + tid = TK_MATCH; } else { - log_error_write(srv, __FILE__, __LINE__, "sbsdsds", + log_error_write(srv, __FILE__, __LINE__, "sbsdsds", "source:", t->source, - "line:", t->line, "pos:", t->line_pos, + "line:", t->line, "pos:", t->line_pos, "only =~ and == are allowed in the condition"); return -1; } @@ -486,51 +486,51 @@ static int config_tokenizer(server *srv, tokenizer_t *t, int *token_id, buffer * t->in_cond = 0; } else if (t->in_key) { tid = TK_ASSIGN; - + buffer_copy_string_len(token, t->input + t->offset, 1); - + t->offset++; t->line_pos++; } else { - log_error_write(srv, __FILE__, __LINE__, "sbsdsds", + log_error_write(srv, __FILE__, __LINE__, "sbsdsds", "source:", t->source, - "line:", t->line, "pos:", t->line_pos, + "line:", t->line, "pos:", t->line_pos, "unexpected equal-sign: ="); return -1; } - + break; - case '!': + case '!': if (t->in_cond) { if (t->input[t->offset + 1] == '=') { t->offset += 2; - + buffer_copy_string(token, "!="); - + tid = TK_NE; } else if (t->input[t->offset + 1] == '~') { t->offset += 2; - + buffer_copy_string(token, "!~"); - + tid = TK_NOMATCH; } else { - log_error_write(srv, __FILE__, __LINE__, "sbsdsds", + log_error_write(srv, __FILE__, __LINE__, "sbsdsds", "source:", t->source, - "line:", t->line, "pos:", t->line_pos, + "line:", t->line, "pos:", t->line_pos, "only !~ and != are allowed in the condition"); return -1; } t->in_key = 1; t->in_cond = 0; } else { - log_error_write(srv, __FILE__, __LINE__, "sbsdsds", + log_error_write(srv, __FILE__, __LINE__, "sbsdsds", "source:", t->source, - "line:", t->line, "pos:", t->line_pos, + "line:", t->line, "pos:", t->line_pos, "unexpected exclamation-marks: !"); return -1; } - + break; case '\t': case ' ': @@ -576,10 +576,10 @@ static int config_tokenizer(server *srv, tokenizer_t *t, int *token_id, buffer * case ',': if (t->in_brace > 0) { tid = TK_COMMA; - + buffer_copy_string(token, "(COMMA)"); } - + t->offset++; t->line_pos++; break; @@ -587,70 +587,70 @@ static int config_tokenizer(server *srv, tokenizer_t *t, int *token_id, buffer * /* search for the terminating " */ start = t->input + t->offset + 1; buffer_copy_string(token, ""); - + for (i = 1; t->input[t->offset + i]; i++) { if (t->input[t->offset + i] == '\\' && t->input[t->offset + i + 1] == '"') { - + buffer_append_string_len(token, start, t->input + t->offset + i - start); - + start = t->input + t->offset + i + 1; - + /* skip the " */ i++; continue; } - - + + if (t->input[t->offset + i] == '"') { tid = TK_STRING; - + buffer_append_string_len(token, start, t->input + t->offset + i - start); - + break; } } if (t->input[t->offset + i] == '\0') { /* ERROR */ - - log_error_write(srv, __FILE__, __LINE__, "sbsdsds", + + log_error_write(srv, __FILE__, __LINE__, "sbsdsds", "source:", t->source, - "line:", t->line, "pos:", t->line_pos, + "line:", t->line, "pos:", t->line_pos, "missing closing quote"); - + return -1; } - + t->offset += i + 1; t->line_pos += i + 1; - + break; case '(': t->offset++; t->in_brace++; - + tid = TK_LPARAN; - + buffer_copy_string(token, "("); break; case ')': t->offset++; t->in_brace--; - + tid = TK_RPARAN; - + buffer_copy_string(token, ")"); break; case '$': t->offset++; - + tid = TK_DOLLAR; t->in_cond = 1; t->in_key = 0; - + buffer_copy_string(token, "$"); - + break; case '+': @@ -667,88 +667,88 @@ static int config_tokenizer(server *srv, tokenizer_t *t, int *token_id, buffer * case '{': t->offset++; - + tid = TK_LCURLY; - + buffer_copy_string(token, "{"); - + break; - + case '}': t->offset++; - + tid = TK_RCURLY; - + buffer_copy_string(token, "}"); - + break; case '[': t->offset++; - + tid = TK_LBRACKET; - + buffer_copy_string(token, "["); - + break; - + case ']': t->offset++; - + tid = TK_RBRACKET; - + buffer_copy_string(token, "]"); - + break; case '#': t->line_pos += config_skip_comment(t); - + break; default: if (t->in_cond) { - for (i = 0; t->input[t->offset + i] && + for (i = 0; t->input[t->offset + i] && (isalpha((unsigned char)t->input[t->offset + i]) ); i++); - + if (i && t->input[t->offset + i]) { tid = TK_SRVVARNAME; buffer_copy_string_len(token, t->input + t->offset, i); - + t->offset += i; t->line_pos += i; } else { /* ERROR */ - log_error_write(srv, __FILE__, __LINE__, "sbsdsds", + log_error_write(srv, __FILE__, __LINE__, "sbsdsds", "source:", t->source, - "line:", t->line, "pos:", t->line_pos, + "line:", t->line, "pos:", t->line_pos, "invalid character in condition"); return -1; } } else if (isdigit((unsigned char)c)) { /* take all digits */ for (i = 0; t->input[t->offset + i] && isdigit((unsigned char)t->input[t->offset + i]); i++); - + /* was there it least a digit ? */ if (i) { tid = TK_INTEGER; - + buffer_copy_string_len(token, t->input + t->offset, i); - + t->offset += i; t->line_pos += i; } } else { /* the key might consist of [-.0-9a-z] */ - for (i = 0; t->input[t->offset + i] && - (isalnum((unsigned char)t->input[t->offset + i]) || + for (i = 0; t->input[t->offset + i] && + (isalnum((unsigned char)t->input[t->offset + i]) || t->input[t->offset + i] == '.' || t->input[t->offset + i] == '_' || /* for env.* */ t->input[t->offset + i] == '-' ); i++); - + if (i && t->input[t->offset + i]) { buffer_copy_string_len(token, t->input + t->offset, i); - + if (strcmp(token->ptr, "include") == 0) { tid = TK_INCLUDE; } else if (strcmp(token->ptr, "include_shell") == 0) { @@ -760,14 +760,14 @@ static int config_tokenizer(server *srv, tokenizer_t *t, int *token_id, buffer * } else { tid = TK_LKEY; } - + t->offset += i; t->line_pos += i; } else { /* ERROR */ - log_error_write(srv, __FILE__, __LINE__, "sbsdsds", + log_error_write(srv, __FILE__, __LINE__, "sbsdsds", "source:", t->source, - "line:", t->line, "pos:", t->line_pos, + "line:", t->line, "pos:", t->line_pos, "invalid character in variable name"); return -1; } @@ -775,16 +775,16 @@ static int config_tokenizer(server *srv, tokenizer_t *t, int *token_id, buffer * break; } } - + if (tid) { *token_id = tid; #if 0 - log_error_write(srv, __FILE__, __LINE__, "sbsdsdbdd", + log_error_write(srv, __FILE__, __LINE__, "sbsdsdbdd", "source:", t->source, "line:", t->line, "pos:", t->line_pos, token, token->used - 1, tid); #endif - + return 1; } else if (t->offset < t->size) { fprintf(stderr, "%s.%d: %d, %s\n", @@ -806,7 +806,7 @@ static int config_parse(server *srv, config_t *context, tokenizer_t *t) { while((1 == (ret = config_tokenizer(srv, t, &token_id, token))) && context->ok) { buffer_copy_string_buffer(lasttoken, token); configparser(pParser, token_id, token, context); - + token = buffer_init(); } buffer_free(token); @@ -819,14 +819,14 @@ static int config_parse(server *srv, config_t *context, tokenizer_t *t) { } } configparserFree(pParser, free); - + if (ret == -1) { - log_error_write(srv, __FILE__, __LINE__, "sb", + log_error_write(srv, __FILE__, __LINE__, "sb", "configfile parser failed at:", lasttoken); } else if (context->ok == 0) { - log_error_write(srv, __FILE__, __LINE__, "sbsdsdsb", + log_error_write(srv, __FILE__, __LINE__, "sbsdsdsb", "source:", t->source, - "line:", t->line, "pos:", t->line_pos, + "line:", t->line, "pos:", t->line_pos, "parser failed somehow near here:", lasttoken); ret = -1; } @@ -843,7 +843,7 @@ static int tokenizer_init(tokenizer_t *t, const buffer *source, const char *inpu t->offset = 0; t->line = 1; t->line_pos = 1; - + t->in_key = 1; t->in_brace = 0; t->in_cond = 0; @@ -866,7 +866,7 @@ int config_parse_file(server *srv, config_t *context, const char *fn) { } if (0 != stream_open(&s, filename)) { - log_error_write(srv, __FILE__, __LINE__, "sbss", + log_error_write(srv, __FILE__, __LINE__, "sbss", "opening configfile ", filename, "failed:", strerror(errno)); ret = -1; } else { @@ -888,7 +888,7 @@ int config_parse_cmd(server *srv, config_t *context, const char *cmd) { char oldpwd[PATH_MAX]; if (NULL == getcwd(oldpwd, sizeof(oldpwd))) { - log_error_write(srv, __FILE__, __LINE__, "s", + log_error_write(srv, __FILE__, __LINE__, "s", "cannot get cwd", strerror(errno)); return -1; } @@ -901,7 +901,7 @@ int config_parse_cmd(server *srv, config_t *context, const char *cmd) { } if (0 != proc_open_buffer(&proc, cmd, NULL, out, NULL)) { - log_error_write(srv, __FILE__, __LINE__, "sbss", + log_error_write(srv, __FILE__, __LINE__, "sbss", "opening", source, "failed:", strerror(errno)); ret = -1; } else { @@ -951,7 +951,7 @@ int config_read(server *srv, const char *fn) { buffer_copy_string_len(context.basedir, fn, pos - fn + 1); fn = pos + 1; } - + dc = data_config_init(); buffer_copy_string(dc->key, "global"); @@ -966,7 +966,7 @@ int config_read(server *srv, const char *fn) { dpid->value = getpid(); buffer_copy_string(dpid->key, "var.PID"); array_insert_unique(srv->config, (data_unset *)dpid); - + dcwd = data_string_init(); buffer_prepare_copy(dcwd->value, 1024); if (NULL != getcwd(dcwd->value->ptr, dcwd->value->size - 1)) { @@ -990,7 +990,7 @@ int config_read(server *srv, const char *fn) { } else { return -1; } - + if (NULL != (modules = (data_array *)array_get_element(srv->config, "server.modules"))) { data_string *ds; data_array *prepends; @@ -1048,12 +1048,12 @@ int config_read(server *srv, const char *fn) { buffer_copy_string(modules->key, "server.modules"); array_insert_unique(srv->config, (data_unset *)modules); } - + if (0 != config_insert(srv)) { return -1; } - + return 0; } @@ -1061,9 +1061,9 @@ int config_set_defaults(server *srv) { size_t i; specific_config *s = srv->config_storage[0]; struct stat st1, st2; - - struct ev_map { fdevent_handler_t et; const char *name; } event_handlers[] = - { + + struct ev_map { fdevent_handler_t et; const char *name; } event_handlers[] = + { /* - poll is most reliable * - select works everywhere * - linux-* are experimental @@ -1089,20 +1089,20 @@ int config_set_defaults(server *srv) { #endif { FDEVENT_HANDLER_UNSET, NULL } }; - - - if (buffer_is_empty(s->document_root)) { - log_error_write(srv, __FILE__, __LINE__, "s", - "a default document-root has to be set"); - - return -1; - } - + + + if (buffer_is_empty(s->document_root)) { + log_error_write(srv, __FILE__, __LINE__, "s", + "a default document-root has to be set"); + + return -1; + } + if (buffer_is_empty(srv->srvconf.changeroot)) { - if (-1 == stat(s->document_root->ptr, &st1)) { - log_error_write(srv, __FILE__, __LINE__, "sb", + if (-1 == stat(s->document_root->ptr, &st1)) { + log_error_write(srv, __FILE__, __LINE__, "sb", "base-docroot doesn't exist:", - s->document_root); + s->document_root); return -1; } @@ -1110,18 +1110,18 @@ int config_set_defaults(server *srv) { buffer_copy_string_buffer(srv->tmp_buf, srv->srvconf.changeroot); buffer_append_string_buffer(srv->tmp_buf, s->document_root); - if (-1 == stat(srv->tmp_buf->ptr, &st1)) { - log_error_write(srv, __FILE__, __LINE__, "sb", + if (-1 == stat(srv->tmp_buf->ptr, &st1)) { + log_error_write(srv, __FILE__, __LINE__, "sb", "base-docroot doesn't exist:", - srv->tmp_buf); + srv->tmp_buf); return -1; } - + } - - buffer_copy_string_buffer(srv->tmp_buf, s->document_root); - buffer_to_lower(srv->tmp_buf); + buffer_copy_string_buffer(srv->tmp_buf, s->document_root); + + buffer_to_lower(srv->tmp_buf); if (0 == stat(srv->tmp_buf->ptr, &st1)) { int is_lower = 0; @@ -1129,68 +1129,68 @@ int config_set_defaults(server *srv) { is_lower = buffer_is_equal(srv->tmp_buf, s->document_root); /* lower-case existed, check upper-case */ - buffer_copy_string_buffer(srv->tmp_buf, s->document_root); + buffer_copy_string_buffer(srv->tmp_buf, s->document_root); - buffer_to_upper(srv->tmp_buf); + buffer_to_upper(srv->tmp_buf); /* we have to handle the special case that upper and lower-casing results in the same filename * as in server.document-root = "/" or "/12345/" */ if (is_lower && buffer_is_equal(srv->tmp_buf, s->document_root)) { - /* lower-casing and upper-casing didn't result in - * an other filename, no need to stat(), + /* lower-casing and upper-casing didn't result in + * an other filename, no need to stat(), * just assume it is case-sensitive. */ s->force_lowercase_filenames = 0; - } else if (0 == stat(srv->tmp_buf->ptr, &st2)) { - - /* upper case exists too, doesn't the FS handle this ? */ - - /* upper and lower have the same inode -> case-insensitve FS */ - - if (st1.st_ino == st2.st_ino) { - /* upper and lower have the same inode -> case-insensitve FS */ - - s->force_lowercase_filenames = 1; - } - } - } - + } else if (0 == stat(srv->tmp_buf->ptr, &st2)) { + + /* upper case exists too, doesn't the FS handle this ? */ + + /* upper and lower have the same inode -> case-insensitve FS */ + + if (st1.st_ino == st2.st_ino) { + /* upper and lower have the same inode -> case-insensitve FS */ + + s->force_lowercase_filenames = 1; + } + } + } + if (srv->srvconf.port == 0) { srv->srvconf.port = s->is_ssl ? 443 : 80; } - + if (srv->srvconf.event_handler->used == 0) { /* choose a good default - * - * the event_handler list is sorted by 'goodness' + * + * the event_handler list is sorted by 'goodness' * taking the first available should be the best solution */ srv->event_handler = event_handlers[0].et; - + if (FDEVENT_HANDLER_UNSET == srv->event_handler) { - log_error_write(srv, __FILE__, __LINE__, "s", + log_error_write(srv, __FILE__, __LINE__, "s", "sorry, there is no event handler for this system"); - + return -1; } } else { /* * User override */ - + for (i = 0; event_handlers[i].name; i++) { if (0 == strcmp(event_handlers[i].name, srv->srvconf.event_handler->ptr)) { srv->event_handler = event_handlers[i].et; break; } } - + if (FDEVENT_HANDLER_UNSET == srv->event_handler) { - log_error_write(srv, __FILE__, __LINE__, "sb", - "the selected event-handler in unknown or not supported:", + log_error_write(srv, __FILE__, __LINE__, "sb", + "the selected event-handler in unknown or not supported:", srv->srvconf.event_handler ); - + return -1; } } @@ -1198,19 +1198,19 @@ int config_set_defaults(server *srv) { if (s->is_ssl) { if (buffer_is_empty(s->ssl_pemfile)) { /* PEM file is require */ - - log_error_write(srv, __FILE__, __LINE__, "s", + + log_error_write(srv, __FILE__, __LINE__, "s", "ssl.pemfile has to be set"); return -1; } - + #ifndef USE_OPENSSL - log_error_write(srv, __FILE__, __LINE__, "s", + log_error_write(srv, __FILE__, __LINE__, "s", "ssl support is missing, recompile with --with-openssl"); - + return -1; #endif } - + return 0; } diff --git a/src/configparser.c b/src/configparser.c index 266a1c7..292cff0 100644 --- a/src/configparser.c +++ b/src/configparser.c @@ -110,10 +110,10 @@ data_unset *configparser_merge_data(data_unset *op1, const data_unset *op2) { /* Next is all token values, in a form suitable for use by makeheaders. ** This section will be null unless lemon is run with the -m switch. */ -/* +/* ** These constants (all generated automatically by the parser generator) ** specify the various kinds of tokens (terminals) that the parser -** understands. +** understands. ** ** Each symbol here is a terminal symbol in the grammar. */ @@ -130,7 +130,7 @@ data_unset *configparser_merge_data(data_unset *op1, const data_unset *op2) { ** and nonterminals. "int" is used otherwise. ** YYNOCODE is a number of type YYCODETYPE which corresponds ** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash +** number is used to fill in empty slots of the hash ** table. ** YYFALLBACK If defined, this indicates that one or more tokens ** have fall-back values which should be used if the @@ -139,7 +139,7 @@ data_unset *configparser_merge_data(data_unset *op1, const data_unset *op2) { ** and nonterminal numbers. "unsigned char" is ** used if there are fewer than 250 rules and ** states combined. "int" is used otherwise. -** configparserTOKENTYPE is the data type used for minor tokens given +** configparserTOKENTYPE is the data type used for minor tokens given ** directly to the parser from the tokenizer. ** YYMINORTYPE is the data type used for all minor tokens. ** This is typically a union of many types, one of @@ -185,7 +185,7 @@ typedef union { /* Next are that tables used to determine what action to take based on the ** current state and lookahead token. These tables are used to implement ** functions that take a state number and lookahead value and return an -** action integer. +** action integer. ** ** Suppose the action integer is N. Then the action is determined as ** follows @@ -210,7 +210,7 @@ typedef union { ** If the index value yy_shift_ofst[S]+X is out of range or if the value ** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] ** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. +** and that yy_default[S] should be used instead. ** ** The formula above is for computing the action when the lookahead is ** a terminal symbol. If the lookahead is a non-terminal (as occurs after @@ -292,7 +292,7 @@ static YYACTIONTYPE yy_default[] = { /* The next table maps tokens into fallback tokens. If a construct ** like the following: -** +** ** %fallback ID X Y Z. ** ** appears in the grammer, then ID becomes a fallback token for X, Y, @@ -343,10 +343,10 @@ static char *yyTracePrompt = 0; #endif /* NDEBUG */ #ifndef NDEBUG -/* +/* ** Turn parser tracing on by giving a stream to which to write the trace ** and a prompt to preface each trace message. Tracing is turned off -** by making either argument NULL +** by making either argument NULL ** ** Inputs: **