More fixes from upstream..

- Fix :port handling in $HTTP["host"] checks.
- Ignore EPIPE/ECONNRESET after SSL_shutdown.
- Add PATCH method.
- Handle ENAMETOOLONG, return 404 Not Found.

ok sthen@
This commit is contained in:
brad 2012-11-15 10:45:23 +00:00
parent daeccc7146
commit fbd221f05c
6 changed files with 107 additions and 2 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.101 2012/07/10 15:22:45 jasper Exp $
# $OpenBSD: Makefile,v 1.102 2012/11/15 10:45:23 brad Exp $
SHARED_ONLY= Yes
COMMENT= secure, fast, compliant, and very flexible web-server
DISTNAME= lighttpd-1.4.31
REVISION= 0
REVISION= 1
CATEGORIES= www net
MASTER_SITES= http://download.lighttpd.net/lighttpd/releases-1.4.x/

View File

@ -0,0 +1,26 @@
$OpenBSD: patch-src_configfile-glue_c,v 1.1 2012/11/15 10:45:23 brad Exp $
Fix :port handling in $HTTP["host"] checks.
--- src/configfile-glue.c.orig Wed Nov 7 21:33:53 2012
+++ src/configfile-glue.c Wed Nov 7 21:33:21 2012
@@ -299,17 +299,13 @@ static cond_result_t config_check_cond_nocache(server
ck_colon = strchr(dc->string->ptr, ':');
val_colon = strchr(l->ptr, ':');
- if (ck_colon == val_colon) {
- /* nothing to do with it */
- break;
- }
- if (ck_colon) {
+ if (NULL != ck_colon && NULL == val_colon) {
/* condition "host:port" but client send "host" */
buffer_copy_string_buffer(srv->cond_check_buf, l);
buffer_append_string_len(srv->cond_check_buf, CONST_STR_LEN(":"));
buffer_append_long(srv->cond_check_buf, sock_addr_get_port(&(srv_sock->addr)));
l = srv->cond_check_buf;
- } else if (!ck_colon) {
+ } else if (NULL != val_colon && NULL == ck_colon) {
/* condition "host" but client send "host:port" */
buffer_copy_string_len(srv->cond_check_buf, l->ptr, val_colon - l->ptr);
l = srv->cond_check_buf;

View File

@ -0,0 +1,36 @@
$OpenBSD: patch-src_connections_c,v 1.21 2012/11/15 10:46:58 brad Exp $
Ignore EPIPE/ECONNRESET after SSL_shutdown.
--- src/connections.c.orig Wed Nov 7 21:34:01 2012
+++ src/connections.c Wed Nov 7 21:30:28 2012
@@ -1712,11 +1712,18 @@ int connection_state_machine(server *srv, connection *
ERR_error_string(err, NULL));
} while((err = ERR_get_error()));
} else if (errno != 0) { /* ssl bug (see lighttpd ticket #2213): sometimes errno == 0 */
- log_error_write(srv, __FILE__, __LINE__, "sddds", "SSL (error):",
+ switch(errno) {
+ case EPIPE:
+ case ECONNRESET:
+ break;
+ default:
+ log_error_write(srv, __FILE__, __LINE__, "sddds", "SSL (error):",
ssl_r, ret, errno,
strerror(errno));
+ break;
+ }
}
-
+
break;
default:
while((err = ERR_get_error())) {
@@ -1724,7 +1731,7 @@ int connection_state_machine(server *srv, connection *
ssl_r, ret,
ERR_error_string(err, NULL));
}
-
+
break;
}
}

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-src_keyvalue_c,v 1.1 2012/11/15 10:46:58 brad Exp $
Add PATCH method.
--- src/keyvalue.c.orig Wed Nov 7 21:34:07 2012
+++ src/keyvalue.c Wed Nov 7 21:32:47 2012
@@ -22,6 +22,7 @@ static keyvalue http_methods[] = {
{ HTTP_METHOD_OPTIONS, "OPTIONS" },
{ HTTP_METHOD_MKCOL, "MKCOL" },
{ HTTP_METHOD_PUT, "PUT" },
+ { HTTP_METHOD_PATCH, "PATCH" },
{ HTTP_METHOD_DELETE, "DELETE" },
{ HTTP_METHOD_COPY, "COPY" },
{ HTTP_METHOD_MOVE, "MOVE" },

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-src_keyvalue_h,v 1.1 2012/11/15 10:46:58 brad Exp $
Add PATCH method.
--- src/keyvalue.h.orig Wed Nov 7 21:34:20 2012
+++ src/keyvalue.h Wed Nov 7 21:32:51 2012
@@ -20,6 +20,7 @@ typedef enum {
HTTP_METHOD_PROPFIND, /* WebDAV */
HTTP_METHOD_MKCOL,
HTTP_METHOD_PUT,
+ HTTP_METHOD_PATCH,
HTTP_METHOD_DELETE,
HTTP_METHOD_COPY,
HTTP_METHOD_MOVE,

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-src_response_c,v 1.5 2012/11/15 10:46:58 brad Exp $
Handle ENAMETOOLONG, return 404 Not Found.
--- src/response.c.orig Wed Nov 7 21:34:30 2012
+++ src/response.c Wed Nov 7 21:32:13 2012
@@ -611,6 +611,8 @@ handler_t http_response_prepare(server *srv, connectio
buffer_reset(con->physical.path);
return HANDLER_FINISHED;
+ case ENAMETOOLONG:
+ /* file name to be read was too long. return 404 */
case ENOENT:
con->http_status = 404;