With autoindexing enabled, HEAD requests to an auto indexed directory
leaks the file descriptor, eventually exhausting them. Patch from
nginx author Igor Sysoev, and bump to p0.

Tested by me on i386, sparc64, amd64.

Please review, test, commit.


Index: ports/www/nginx/Makefile
===================================================================
RCS file: /cvs/ports/www/nginx/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile
--- ports/www/nginx/Makefile    4 Sep 2007 21:58:26 -0000       1.1.1.1
+++ ports/www/nginx/Makefile    22 Sep 2007 20:14:48 -0000
@@ -3,6 +3,7 @@
 COMMENT=       robust and small HTTP server and IMAP/POP3 proxy server
 
 DISTNAME=      nginx-0.5.31
+PKGNAME=       ${DISTNAME}p0
 CATEGORIES=    www
 
 HOMEPAGE=      http://nginx.net/
Index: 
ports/www/nginx/patches/patch-src_http_modules_ngx_http_autoindex_module_c
===================================================================
RCS file: 
ports/www/nginx/patches/patch-src_http_modules_ngx_http_autoindex_module_c
diff -N 
ports/www/nginx/patches/patch-src_http_modules_ngx_http_autoindex_module_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ ports/www/nginx/patches/patch-src_http_modules_ngx_http_autoindex_module_c  
22 Sep 2007 20:14:48 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+--- src/http/modules/ngx_http_autoindex_module.c.orig  Mon Nov 13 13:53:37 2006
++++ src/http/modules/ngx_http_autoindex_module.c       Sat Sep 22 10:58:02 2007
+@@ -236,6 +236,11 @@ ngx_http_autoindex_handler(ngx_http_requ
+     rc = ngx_http_send_header(r);
+ 
+     if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
++        if (ngx_close_dir(&dir) == NGX_ERROR) {
++            ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno,
++                          ngx_close_dir_n " \"%V\" failed", &path);
++        }
++
+         return rc;
+     }
+ 

-- 
Darrin Chandler            |  Phoenix BSD User Group  |  MetaBUG
[EMAIL PROTECTED]   |  http://phxbug.org/      |  http://metabug.org/
http://www.stilyagin.com/  |  Daemons in the Desert   |  Global BUG Federation

Attachment: pgpkg0zAxs4Lw.pgp
Description: PGP signature

Reply via email to