lighttpd 1.4.27; various fixes/cleanup. From Brad, small conf tweak from me.

This commit is contained in:
sthen 2010-08-18 11:16:55 +00:00
parent 19c8a21871
commit 19895d4c56
11 changed files with 361 additions and 231 deletions

View File

@ -1,11 +1,10 @@
# $OpenBSD: Makefile,v 1.69 2010/07/06 17:17:50 sthen Exp $
# $OpenBSD: Makefile,v 1.70 2010/08/18 11:16:55 sthen Exp $
SHARED_ONLY= Yes
COMMENT= secure, fast, compliant, and very flexible web-server
DISTNAME= lighttpd-1.4.26
PKGNAME= ${DISTNAME}p2
DISTNAME= lighttpd-1.4.27
CATEGORIES= www net
MASTER_SITES= http://download.lighttpd.net/lighttpd/releases-1.4.x/
@ -50,11 +49,11 @@ CONFIGURE_ARGS+= --with-mysql
LIB_DEPENDS+= mysqlclient.>=10::databases/mysql
.endif
post-extract:
@cp -f ${FILESDIR}/lighttpd.conf ${WRKSRC}/doc
pre-build:
@perl -pi -e "s,/usr/bin/rrdtool,${LOCALBASE}/bin/rrdtool,g" \
${WRKSRC}/doc/lighttpd.conf
@perl -pi -e "s,/etc/lighttpd,${SYSCONFDIR},g" \
${WRKSRC}/doc/lighttpd.8
@${SUBST_CMD} ${WRKSRC}/doc/lighttpd.conf ${WRKSRC}/doc/lighttpd.8
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/lighttpd
@ -63,7 +62,7 @@ post-install:
${PREFIX}/share/doc/lighttpd
${INSTALL_DATA} ${WRKSRC}/doc/lighttpd.conf \
${PREFIX}/share/examples/lighttpd
${INSTALL_DATA} ${WRKSRC}/doc/spawn-php.sh \
${INSTALL_DATA} ${WRKSRC}/doc/scripts/spawn-php.sh \
${PREFIX}/share/examples/lighttpd
${INSTALL_DATA} /dev/null \
${PREFIX}/share/examples/lighttpd/access.log

View File

@ -1,5 +1,5 @@
MD5 (lighttpd-1.4.26.tar.gz) = POW+F6Taw8OEqKRSxmS4QA==
RMD160 (lighttpd-1.4.26.tar.gz) = Cwc9ZkBe+4sqK6id/wiuWBN3EGU=
SHA1 (lighttpd-1.4.26.tar.gz) = wiZC3DYWBDKT+4lbnwSbknDbsqA=
SHA256 (lighttpd-1.4.26.tar.gz) = CPwRhkoK1tKHHzLm0LDq6wcPeGmKcpWfgSUmFzFFmG4=
SIZE (lighttpd-1.4.26.tar.gz) = 780352
MD5 (lighttpd-1.4.27.tar.gz) = 4gz8tN+Pv/yHES9DjqwzYA==
RMD160 (lighttpd-1.4.27.tar.gz) = 2iqxaA3P4q7wkTr9yubakpj2138=
SHA1 (lighttpd-1.4.27.tar.gz) = V4zFGQO0bFFvDuVlhCy1JZM6uwI=
SHA256 (lighttpd-1.4.27.tar.gz) = qGbm4bMwB/PFp7pH23uFAmJUoJSru/X6GC5TWdtNdOs=
SIZE (lighttpd-1.4.27.tar.gz) = 808190

View File

@ -0,0 +1,309 @@
# lighttpd configuration file
############ Options you really have to take care of ####################
## modules to load
# at least mod_access and mod_accesslog should be loaded
# all other module should only be loaded if really neccesary
# - saves some time
# - saves memory
server.modules = (
# "mod_rewrite",
# "mod_redirect",
# "mod_alias",
"mod_access",
# "mod_trigger_b4_dl",
# "mod_auth",
# "mod_status",
# "mod_setenv",
# "mod_fastcgi",
# "mod_proxy",
# "mod_simple_vhost",
# "mod_evhost",
# "mod_userdir",
# "mod_cgi",
# "mod_compress",
# "mod_ssi",
# "mod_usertrack",
# "mod_expire",
# "mod_secdownload",
# "mod_rrdtool",
"mod_accesslog" )
## A static document-root. For virtual hosting take a look at the
## mod_simple_vhost module.
server.document-root = "htdocs/"
#### accesslog module
accesslog.filename = "logs/access.log"
## where to send error-messages to
server.errorlog = "logs/error.log"
# files to check for if .../ is requested
index-file.names = ( "index.html", "index.htm", "default.htm" )
server.event-handler = "kqueue"
server.network-backend = "writev"
server.bind = "0.0.0.0"
server.port = "80"
$SERVER["socket"] == "[::]:80" { }
# mimetype mapping
mimetype.assign = (
".pdf" => "application/pdf",
".sig" => "application/pgp-signature",
".spl" => "application/futuresplash",
".class" => "application/octet-stream",
".ps" => "application/postscript",
".torrent" => "application/x-bittorrent",
".dvi" => "application/x-dvi",
".gz" => "application/x-gzip",
".pac" => "application/x-ns-proxy-autoconfig",
".swf" => "application/x-shockwave-flash",
".tar.gz" => "application/x-tgz",
".tgz" => "application/x-tgz",
".tar" => "application/x-tar",
".zip" => "application/zip",
".mp3" => "audio/mpeg",
".m3u" => "audio/x-mpegurl",
".wma" => "audio/x-ms-wma",
".wax" => "audio/x-ms-wax",
".ogg" => "application/ogg",
".wav" => "audio/x-wav",
".gif" => "image/gif",
".jar" => "application/x-java-archive",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".png" => "image/png",
".xbm" => "image/x-xbitmap",
".xpm" => "image/x-xpixmap",
".xwd" => "image/x-xwindowdump",
".css" => "text/css",
".html" => "text/html",
".htm" => "text/html",
".js" => "text/javascript",
".asc" => "text/plain",
".c" => "text/plain",
".cpp" => "text/plain",
".log" => "text/plain",
".conf" => "text/plain",
".text" => "text/plain",
".txt" => "text/plain",
".dtd" => "text/xml",
".xml" => "text/xml",
".mpeg" => "video/mpeg",
".mpg" => "video/mpeg",
".mov" => "video/quicktime",
".qt" => "video/quicktime",
".avi" => "video/x-msvideo",
".asf" => "video/x-ms-asf",
".asx" => "video/x-ms-asf",
".wmv" => "video/x-ms-wmv",
".bz2" => "application/x-bzip",
".tbz" => "application/x-bzip-compressed-tar",
".tar.bz2" => "application/x-bzip-compressed-tar",
# default mime type
"" => "application/octet-stream",
)
# Use the "Content-Type" extended attribute to obtain mime type if possible
#mimetype.use-xattr = "enable"
## send a different Server: header
## be nice and keep it at lighttpd
# server.tag = "lighttpd"
## deny access the file-extensions
#
# ~ is for backupfiles from vi, emacs, joe, ...
# .inc is often used for code includes which should in general not be part
# of the document-root
url.access-deny = ( "~", ".inc" )
$HTTP["url"] =~ "\.pdf$" {
server.range-requests = "disable"
}
##
# which extensions should not be handle via static-file transfer
#
# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
######### Options that are good to be but not neccesary to be changed #######
## error-handler for status 404
#server.error-handler-404 = "/error-handler.html"
#server.error-handler-404 = "/error-handler.php"
## to help the rc.scripts
server.pid-file = "/var/run/lighttpd.pid"
###### virtual hosts
##
## If you want name-based virtual hosting add the next three settings and load
## mod_simple_vhost
##
## document-root =
## virtual-server-root + virtual-server-default-host + virtual-server-docroot
## or
## virtual-server-root + http-host + virtual-server-docroot
##
#simple-vhost.server-root = "/srv/www/vhosts/"
#simple-vhost.default-host = "www.example.org"
#simple-vhost.document-root = "/htdocs/"
##
## Format: <errorfile-prefix><status-code>.html
## -> ..../status-404.html for 'File not found'
#server.errorfile-prefix = "/usr/share/lighttpd/errors/status-"
#server.errorfile-prefix = "/srv/www/errors/status-"
## virtual directory listings
#dir-listing.activate = "enable"
## select encoding for directory listings
#dir-listing.encoding = "utf-8"
## enable debugging
#debug.log-request-header = "enable"
#debug.log-response-header = "enable"
#debug.log-request-handling = "enable"
#debug.log-file-not-found = "enable"
# chroot() to directory
server.chroot = "/var/www/"
server.username = "_lighttpd"
server.groupname = "_lighttpd"
#### compress module
#compress.cache-dir = "/var/cache/lighttpd/compress/"
#compress.filetype = ("text/plain", "text/html")
#### proxy module
## read proxy.txt for more info
#proxy.server = ( ".php" =>
# ( "localhost" =>
# (
# "host" => "192.168.0.101",
# "port" => 80
# )
# )
# )
#### fastcgi module
## read fastcgi.txt for more info
## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
#fastcgi.server = ( ".php" =>
# ( "localhost" =>
# (
# "socket" => "/var/run/lighttpd/php-fastcgi.socket",
# "bin-path" => "/usr/local/bin/php-cgi"
# )
# )
# )
#### CGI module
#cgi.assign = ( ".pl" => "/usr/bin/perl",
# ".cgi" => "/usr/bin/perl" )
#
#### SSL engine
#ssl.engine = "enable"
#ssl.pemfile = "/etc/ssl/private/lighttpd.pem"
#### status module
#status.status-url = "/server-status"
#status.config-url = "/server-config"
#### auth module
## read authentication.txt for more info
#auth.backend = "plain"
#auth.backend.plain.userfile = "lighttpd.user"
#auth.backend.plain.groupfile = "lighttpd.group"
#auth.backend.ldap.hostname = "localhost"
#auth.backend.ldap.base-dn = "dc=my-domain,dc=com"
#auth.backend.ldap.filter = "(uid=$)"
#auth.require = ( "/server-status" =>
# (
# "method" => "digest",
# "realm" => "download archiv",
# "require" => "user=jan"
# ),
# "/server-config" =>
# (
# "method" => "digest",
# "realm" => "download archiv",
# "require" => "valid-user"
# )
# )
#### url handling modules (rewrite, redirect, access)
#url.rewrite = ( "^/$" => "/server-status" )
#url.redirect = ( "^/wishlist/(.+)" => "http://www.123.org/$1" )
#### both rewrite/redirect support back reference to regex conditional using %n
#$HTTP["host"] =~ "^www\.(.*)" {
# url.redirect = ( "^/(.*)" => "http://%1/$1" )
#}
#
# define a pattern for the host url finding
# %% => % sign
# %0 => domain name + tld
# %1 => tld
# %2 => domain name without tld
# %3 => subdomain 1 name
# %4 => subdomain 2 name
#
#evhost.path-pattern = "/srv/www/vhosts/%3/htdocs/"
#### expire module
#expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes")
#### ssi
#ssi.extension = ( ".shtml" )
#### rrdtool
#rrdtool.binary = "${LOCALBASE}/bin/rrdtool"
#rrdtool.db-name = "/var/lib/lighttpd/lighttpd.rrd"
#### setenv
#setenv.add-request-header = ( "TRAV_ENV" => "mysql://user@host/db" )
#setenv.add-response-header = ( "X-Secret-Message" => "42" )
## for mod_trigger_b4_dl
# trigger-before-download.gdbm-filename = "/var/lib/lighttpd/trigger.db"
# trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
# trigger-before-download.trigger-url = "^/trigger/"
# trigger-before-download.download-url = "^/download/"
# trigger-before-download.deny-url = "http://127.0.0.1/index.html"
# trigger-before-download.trigger-timeout = 10
#### variable usage:
## variable name without "." is auto prefixed by "var." and becomes "var.bar"
#bar = 1
#var.mystring = "foo"
## integer add
#bar += 1
## string concat, with integer cast as string, result: "www.foo1.com"
#server.name = "www." + mystring + var.bar + ".com"
## array merge
#index-file.names = (foo + ".php") + index-file.names
#index-file.names += (foo + ".php")
#### include
#include /etc/lighttpd/lighttpd-inc.conf
## same as above if you run: "lighttpd -f /etc/lighttpd/lighttpd.conf"
#include "lighttpd-inc.conf"
#### include_shell
#include_shell "echo var.a=1"
## the above is same as:
#var.a=1

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-configure_ac,v 1.1 2010/07/06 17:17:50 sthen Exp $
--- configure.ac.orig Tue Jul 6 08:56:41 2010
+++ configure.ac Tue Jul 6 08:57:51 2010
@@ -548,7 +548,17 @@ AM_CONDITIONAL(CHECK_WITH_FASTCGI, test "x$fastcgi_fou
$OpenBSD: patch-configure_ac,v 1.2 2010/08/18 11:16:55 sthen Exp $
--- configure.ac.orig Sat Aug 7 05:31:29 2010
+++ configure.ac Sun Aug 8 22:18:59 2010
@@ -585,7 +585,17 @@ AM_CONDITIONAL(CHECK_WITH_FASTCGI, test "x$fastcgi_fou
dnl check for extra compiler options (warning options)
if test "${GCC}" = "yes"; then

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-doc_lighttpd_8,v 1.1 2010/08/18 11:16:55 sthen Exp $
--- doc/lighttpd.8.orig Sun Aug 8 22:29:24 2010
+++ doc/lighttpd.8 Sun Aug 8 22:29:58 2010
@@ -47,7 +47,7 @@ Show a brief help message and exit.
.
.SH FILES
.TP 8
-/etc/lighttpd/lighttpd.conf
+${SYSCONFDIR}/lighttpd.conf
The standard location for the configuration file.
.TP 8
/var/run/lighttpd.pid

View File

@ -1,102 +0,0 @@
$OpenBSD: patch-doc_lighttpd_conf,v 1.8 2009/06/19 23:12:03 sthen Exp $
--- doc/lighttpd.conf.orig Thu Apr 9 16:02:00 2009
+++ doc/lighttpd.conf Mon Jun 15 01:09:14 2009
@@ -36,18 +36,24 @@ server.modules = (
## A static document-root. For virtual hosting take a look at the
## mod_simple_vhost module.
-server.document-root = "/srv/www/htdocs/"
+server.document-root = "htdocs/"
+#### accesslog module
+accesslog.filename = "logs/access.log"
+
## where to send error-messages to
-server.errorlog = "/var/log/lighttpd/error.log"
+server.errorlog = "logs/error.log"
# files to check for if .../ is requested
-index-file.names = ( "index.php", "index.html",
- "index.htm", "default.htm" )
+index-file.names = ( "index.html", "index.htm", "default.htm" )
-## set the event-handler (read the performance section in the manual)
-# server.event-handler = "freebsd-kqueue" # needed on OS X
+server.event-handler = "kqueue"
+server.network-backend = "writev"
+server.use-ipv6 = "enable"
+
+$SERVER["socket"] == "0.0.0.0:80" { }
+
# mimetype mapping
mimetype.assign = (
".pdf" => "application/pdf",
@@ -109,14 +115,10 @@ mimetype.assign = (
# Use the "Content-Type" extended attribute to obtain mime type if possible
#mimetype.use-xattr = "enable"
-
## send a different Server: header
## be nice and keep it at lighttpd
# server.tag = "lighttpd"
-#### accesslog module
-accesslog.filename = "/var/log/lighttpd/access.log"
-
## deny access the file-extensions
#
# ~ is for backupfiles from vi, emacs, joe, ...
@@ -136,20 +138,13 @@ static-file.exclude-extensions = ( ".php", ".pl", ".fc
######### Options that are good to be but not neccesary to be changed #######
-## bind to port (default: 80)
-#server.port = 81
-
-## bind to localhost (default: all interfaces)
-#server.bind = "127.0.0.1"
-
## error-handler for status 404
#server.error-handler-404 = "/error-handler.html"
#server.error-handler-404 = "/error-handler.php"
## to help the rc.scripts
-#server.pid-file = "/var/run/lighttpd.pid"
+server.pid-file = "/var/run/lighttpd.pid"
-
###### virtual hosts
##
## If you want name-based virtual hosting add the next three settings and load
@@ -182,17 +177,12 @@ static-file.exclude-extensions = ( ".php", ".pl", ".fc
#debug.log-request-handling = "enable"
#debug.log-file-not-found = "enable"
-### only root can use these options
-#
-# chroot() to directory (default: no chroot() )
-#server.chroot = "/"
+# chroot() to directory
+server.chroot = "/var/www/"
-## change uid to <uid> (default: don't care)
-#server.username = "wwwrun"
+server.username = "_lighttpd"
+server.groupname = "_lighttpd"
-## change uid to <uid> (default: don't care)
-#server.groupname = "wwwrun"
-
#### compress module
#compress.cache-dir = "/var/cache/lighttpd/compress/"
#compress.filetype = ("text/plain", "text/html")
@@ -283,7 +273,7 @@ static-file.exclude-extensions = ( ".php", ".pl", ".fc
#ssi.extension = ( ".shtml" )
#### rrdtool
-#rrdtool.binary = "/usr/bin/rrdtool"
+#rrdtool.binary = "/usr/local/bin/rrdtool"
#rrdtool.db-name = "/var/lib/lighttpd/lighttpd.rrd"
#### setenv

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-src_fdevent_freebsd_kqueue_c,v 1.1 2010/08/18 11:16:55 sthen Exp $
--- src/fdevent_freebsd_kqueue.c.orig Sun Aug 15 22:23:45 2010
+++ src/fdevent_freebsd_kqueue.c Sun Aug 15 22:24:59 2010
@@ -39,12 +39,15 @@ static int fdevent_freebsd_kqueue_event_del(fdevents *
NULL, 0,
&ts);
+ /* Ignore errors for now, as we remove for READ and WRITE without knowing what was registered */
+#if 0
if (ret == -1) {
log_error_write(ev->srv, __FILE__, __LINE__, "SS",
"kqueue event delete failed: ", strerror(errno));
return -1;
}
+#endif
return -1;
}

View File

@ -1,19 +0,0 @@
$OpenBSD: patch-src_mod_accesslog_c,v 1.1 2010/07/06 17:17:50 sthen Exp $
--- src/mod_accesslog.c.orig Tue Jul 6 08:59:22 2010
+++ src/mod_accesslog.c Tue Jul 6 09:01:04 2010
@@ -157,12 +157,14 @@ INIT_FUNC(mod_accesslog_init) {
}
static void accesslog_append_escaped(buffer *dest, buffer *str) {
+ unsigned int i;
+
/* replaces non-printable chars with \xHH where HH is the hex representation of the byte */
/* exceptions: " => \", \ => \\, whitespace chars => \n \t etc. */
if (str->used == 0) return;
buffer_prepare_append(dest, str->used - 1);
- for (unsigned int i = 0; i < str->used - 1; i++) {
+ for (i = 0; i < str->used - 1; i++) {
if (str->ptr[i] >= ' ' && str->ptr[i] <= '~') {
/* printable chars */
buffer_append_string_len(dest, &str->ptr[i], 1);

View File

@ -1,58 +0,0 @@
$OpenBSD: patch-src_mod_proxy_c,v 1.3 2010/04/09 11:06:22 sthen Exp $
--- src/mod_proxy.c.orig Mon Feb 1 18:28:20 2010
+++ src/mod_proxy.c Wed Apr 7 21:05:00 2010
@@ -349,6 +349,10 @@ static void proxy_connection_close(server *srv, handle
srv->cur_fds--;
}
+ if (hctx->host) {
+ hctx->host->usage--;
+ }
+
handler_ctx_free(hctx);
con->plugin_ctx[p->id] = NULL;
}
@@ -848,11 +852,11 @@ static handler_t proxy_write_request(server *srv, hand
if (-1 == ret) { /* error on our side */
log_error_write(srv, __FILE__, __LINE__, "ssd", "write failed:", strerror(errno), errno);
- return HANDLER_WAIT_FOR_EVENT;
+ return HANDLER_ERROR;
} else if (-2 == ret) { /* remote close */
log_error_write(srv, __FILE__, __LINE__, "ssd", "write failed, remote connection close:", strerror(errno), errno);
- return HANDLER_WAIT_FOR_EVENT;
+ return HANDLER_ERROR;
}
if (hctx->wb->bytes_out == hctx->wb->bytes_in) {
@@ -989,8 +993,6 @@ static handler_t proxy_handle_fdevent(void *s, void *c
case 0:
break;
case 1:
- hctx->host->usage--;
-
/* we are done */
proxy_connection_close(srv, hctx);
@@ -1077,8 +1079,11 @@ static handler_t proxy_handle_fdevent(void *s, void *c
return HANDLER_FINISHED;
}
- con->file_finished = 1;
+ if (!con->file_finished) {
+ http_chunk_append_mem(srv, con, NULL, 0);
+ }
+ con->file_finished = 1;
proxy_connection_close(srv, hctx);
joblist_append(srv, con);
} else if (revents & FDEVENT_ERR) {
@@ -1086,6 +1091,7 @@ static handler_t proxy_handle_fdevent(void *s, void *c
log_error_write(srv, __FILE__, __LINE__, "sd", "proxy-FDEVENT_ERR, but no HUP", revents);
+ con->file_finished = 1;
joblist_append(srv, con);
proxy_connection_close(srv, hctx);
}

View File

@ -1,30 +0,0 @@
$OpenBSD: patch-src_response_c,v 1.3 2010/04/18 08:24:31 sthen Exp $
--- src/response.c.orig Sat Apr 17 21:03:28 2010
+++ src/response.c Sat Apr 17 21:06:03 2010
@@ -136,6 +136,8 @@ static void https_add_ssl_entries(connection *con) {
X509 *xs;
X509_NAME *xn;
X509_NAME_ENTRY *xe;
+ int i, nentries;
+
if (
SSL_get_verify_result(con->ssl) != X509_V_OK
|| !(xs = SSL_get_peer_certificate(con->ssl))
@@ -144,7 +146,7 @@ static void https_add_ssl_entries(connection *con) {
}
xn = X509_get_subject_name(xs);
- for (int i = 0, nentries = X509_NAME_entry_count(xn); i < nentries; ++i) {
+ for (i = 0, nentries = X509_NAME_entry_count(xn); i < nentries; ++i) {
int xobjnid;
const char * xobjsn;
data_string *envds;
@@ -581,7 +583,7 @@ handler_t http_response_prepare(server *srv, connectio
};
#endif
if (S_ISDIR(sce->st.st_mode)) {
- if (con->physical.path->ptr[con->physical.path->used - 2] != '/') {
+ if (con->uri.path->ptr[con->uri.path->used - 2] != '/') {
/* redirect to .../ */
http_response_redirect_to_directory(srv, con);

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-src_server_c,v 1.7 2009/10/27 23:02:11 sthen Exp $
--- src/server.c.orig Wed Oct 14 14:05:43 2009
+++ src/server.c Mon Oct 19 16:44:37 2009
$OpenBSD: patch-src_server_c,v 1.8 2010/08/18 11:16:55 sthen Exp $
--- src/server.c.orig Sat Aug 7 07:00:16 2010
+++ src/server.c Sun Aug 8 22:18:55 2010
@@ -211,7 +211,7 @@ static server *server_init(void) {
srv->mtime_cache[i].str = buffer_init();
}
@ -8,5 +8,5 @@ $OpenBSD: patch-src_server_c,v 1.7 2009/10/27 23:02:11 sthen Exp $
- if ((NULL != (frandom = fopen("/dev/urandom", "rb")) || NULL != (frandom = fopen("/dev/random", "rb")))
+ if ((NULL != (frandom = fopen("/dev/arandom", "rb")) || NULL != (frandom = fopen("/dev/urandom", "rb")))
&& 1 == fread(srv->entropy, sizeof(srv->entropy), 1, frandom)) {
srand(*(unsigned int*)srv->entropy);
srv->is_real_entropy = 1;
unsigned int e;
memcpy(&e, srv->entropy, sizeof(e) < sizeof(srv->entropy) ? sizeof(e) : sizeof(srv->entropy));