]> git.kaiwu.me - nginx.git/commitdiff
nginx-0.3.41-RELEASE import release-0.3.41
authorIgor Sysoev <igor@sysoev.ru>
Fri, 21 Apr 2006 12:06:44 +0000 (12:06 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Fri, 21 Apr 2006 12:06:44 +0000 (12:06 +0000)
    *) Feature: the -v switch.

    *) Bugfix: the segmentation fault may occurred if the SSI page has
       remote subrequests.

    *) Bugfix: in FastCGI handling.

    *) Bugfix: if the perl modules path was not set using
       --with-perl_modules_path=PATH or the "perl_modules", then the
       segmentation fault was occurred.

docs/xml/nginx/changes.xml
src/core/nginx.c
src/core/nginx.h
src/core/ngx_log.c
src/http/modules/ngx_http_dav_module.c
src/http/modules/ngx_http_fastcgi_module.c
src/http/modules/ngx_http_static_module.c
src/http/modules/perl/ngx_http_perl_module.c
src/http/ngx_http_parse.c
src/http/ngx_http_request.c
src/os/unix/ngx_shmem.c

index 20e5d0c5b688b22db231389897209cff88bc25ea..43722d6304afb640605048472c188f803ef0f348 100644 (file)
@@ -9,6 +9,52 @@
 <title lang="en">nginx changelog</title>
 
 
+<changes ver="0.3.41" date="21.04.2006">
+
+<change type="feature">
+<para lang="ru">
+ËÌÀÞ -v.
+</para>
+<para lang="en">
+the -v switch.
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+ÐÒÉ ×ËÌÀÞÅÎÉÉ × SSI ÕÄÁÌ£ÎÎÙÈ ÐÏÄÚÁÐÒÏÓÏ×
+ÍÏÇ ÐÒÏÉÚÏÊÔÉ segmentation fault.
+</para>
+<para lang="en">
+the segmentation fault may occurred if the SSI page has remote subrequests.
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+× ÏÂÒÁÂÏÔËÅ FastCGI.
+</para>
+<para lang="en">
+in FastCGI handling.
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+ÅÓÌÉ ÐÕÔØ Ë ÐÅÒÌÏ×ÙÍ ÍÏÄÕÌÑÍ ÎÅ ÂÙÌ ÕËÁÚÁΠӠÐÏÍÏÝØÀ
+--with-perl_modules_path=PATH ÉÌÉ ÄÉÒÅËÔÉ×Ù perl_modules,
+ÔÏ ÎÁ ÓÔÁÒÔÅ ÐÒÏÉÓÈÏÄÉÌ segmentation fault.
+</para>
+<para lang="en">
+if the perl modules path was not set using
+--with-perl_modules_path=PATH or the "perl_modules", then
+the segmentation fault was occurred.
+</para>
+</change>
+
+</changes>
+
+
 <changes ver="0.3.40" date="19.04.2006">
 
 <change type="feature">
index 12a2b8a2548926ac632924e983a4aac241e9e6f9..484919862252a5367f669c3576ad8002ac5cf774 100644 (file)
@@ -175,7 +175,9 @@ ngx_module_t  ngx_core_module = {
 
 ngx_uint_t  ngx_max_module;
 
-static char *ngx_null_environ = NULL;
+static ngx_uint_t  ngx_show_version;
+
+static char  *ngx_null_environ = NULL;
 
 
 int ngx_cdecl
@@ -229,6 +231,17 @@ main(int argc, char *const *argv)
         return 1;
     }
 
+    if (ngx_show_version) {
+        ngx_write_fd(ngx_stderr_fileno, "nginx version: " NGINX_VER CRLF,
+                     sizeof("nginx version: " NGINX_VER CRLF) - 1);
+
+#ifdef NGX_COMPILER
+        ngx_write_fd(ngx_stderr_fileno, "built by " NGX_COMPILER CRLF,
+                     sizeof("built by " NGX_COMPILER CRLF) - 1);
+#endif
+        return 0;
+    }
+
     if (ngx_test_config) {
         log->log_level = NGX_LOG_INFO;
     }
@@ -472,6 +485,10 @@ ngx_getopt(ngx_cycle_t *cycle, int argc, char *const *argv)
 
         switch (argv[i][1]) {
 
+        case 'v':
+            ngx_show_version = 1;
+            break;
+
         case 't':
             ngx_test_config = 1;
             break;
index 2e13e6be44aff4177ee181ff990219e27a51ffcb..ec230610f99e803b469ba4f9d75410aaf0cddd5f 100644 (file)
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VER          "nginx/0.3.40"
+#define NGINX_VER          "nginx/0.3.41"
 
 #define NGINX_VAR          "NGINX"
 #define NGX_OLDPID_EXT     ".oldbin"
index 9e23592ea3becfb2ce4764c2b97603489671760a..21d59780f375286a52c5c09bd9db4cff8b84a5b1 100644 (file)
@@ -198,6 +198,8 @@ ngx_log_init(void)
 
 #if (NGX_WIN32)
 
+    ngx_stderr_fileno = GetStdHandle(STD_ERROR_HANDLE);
+
     ngx_stderr.fd = ngx_open_file(NGX_ERROR_LOG_PATH, NGX_FILE_RDWR,
                                   NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND);
 
index e60b8cf34f32f6d6ee7eb52721e07f6b1767367e..b41bd8e467fbdf4020d0bb417b794e3ecf87e811 100644 (file)
@@ -116,10 +116,6 @@ ngx_http_dav_handler(ngx_http_request_t *r)
             return NGX_DECLINED;
         }
 
-        if (r->headers_in.content_length_n < 0) {
-            return NGX_HTTP_BAD_REQUEST;
-        }
-
         r->request_body_in_file_only = 1;
         r->request_body_in_persistent_file = 1;
         r->request_body_delete_incomplete_file = 1;
@@ -312,6 +308,8 @@ ok:
             ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
             return;
         }
+
+        r->headers_out.content_length_n = 0;
     }
 
     r->headers_out.status = status;
index f901a52233aa9e68f9ded2914aced66e0b7efa7a..ff55118049d8835c80acd5902f2b1c7c89c85498 100644 (file)
@@ -1173,6 +1173,11 @@ ngx_http_fastcgi_input_filter(ngx_event_pipe_t *p, ngx_buf_t *buf)
         if (f->type == NGX_HTTP_FASTCGI_STDERR) {
 
             if (f->length) {
+
+                if (f->pos == f->last) {
+                    break;
+                }
+
                 line.data = f->pos;
 
                 if (f->pos + f->length <= f->last) {
@@ -1212,6 +1217,10 @@ ngx_http_fastcgi_input_filter(ngx_event_pipe_t *p, ngx_buf_t *buf)
 
         /* f->type == NGX_HTTP_FASTCGI_STDOUT */
 
+        if (f->pos == f->last) {
+            break;
+        }
+
         if (p->free) {
             b = p->free->buf;
             p->free = p->free->next;
index 0dbec5093a199c2d74ddacaa9c3aa93b8db3fbe4..3399e5098c4f5f6f865d928101b5a363d3ec4813 100644 (file)
@@ -86,6 +86,10 @@ ngx_http_static_handler(ngx_http_request_t *r)
     ngx_pool_cleanup_file_t   *clnf;
     ngx_http_core_loc_conf_t  *clcf;
 
+    if (r->method != NGX_HTTP_GET && r->method != NGX_HTTP_HEAD) {
+        return NGX_HTTP_NOT_ALLOWED;
+    }
+
     if (r->uri.data[r->uri.len - 1] == '/') {
         return NGX_DECLINED;
     }
@@ -95,10 +99,6 @@ ngx_http_static_handler(ngx_http_request_t *r)
         return NGX_DECLINED;
     }
 
-    if (r->method != NGX_HTTP_GET && r->method != NGX_HTTP_HEAD) {
-        return NGX_HTTP_NOT_ALLOWED;
-    }
-
     rc = ngx_http_discard_body(r);
 
     if (rc != NGX_OK && rc != NGX_AGAIN) {
index 136bac397b8449e73c92a66bef48b1c035eb3539..aa0e41d2572d301b046fc239b0dd9857c3718f85 100644 (file)
@@ -483,8 +483,10 @@ ngx_http_perl_init_interpreter(ngx_conf_t *cf, ngx_http_perl_main_conf_t *pmcf)
     }
 #endif
 
-    if (ngx_conf_full_name(cf->cycle, &pmcf->modules) != NGX_OK) {
-        return NGX_CONF_ERROR;
+    if (pmcf->modules.data) {
+        if (ngx_conf_full_name(cf->cycle, &pmcf->modules) != NGX_OK) {
+            return NGX_CONF_ERROR;
+        }
     }
 
     PERL_SYS_INIT(&ngx_argc, &ngx_argv);
index 11c1632901f2f5954a3f22cf2dd24a23cea02e7d..1b1e963ad36967ccddb3bc955db164762b2d9b6b 100644 (file)
@@ -67,17 +67,18 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
                 r->method_end = p - 1;
                 m = r->request_start;
 
-                if (p - m == 3) {
+                switch (p - m) {
 
+                case 3:
                     if (m[0] == 'G' && m[1] == 'E' && m[2] == 'T') {
                         r->method = NGX_HTTP_GET;
 
                     } else if (m[0] == 'P' && m[1] == 'U' && m[2] == 'T') {
                         r->method = NGX_HTTP_PUT;
                     }
+                    break;
 
-                } else if (p - m == 4) {
-
+                case 4:
                     if (m[0] == 'P' && m[1] == 'O'
                         && m[2] == 'S' && m[3] == 'T')
                     {
@@ -88,22 +89,23 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
                     {
                         r->method = NGX_HTTP_HEAD;
                     }
+                    break;
 
-                } else if (p - m == 5) {
-
+                case 5:
                     if (m[0] == 'M' && m[1] == 'K'
                         && m[2] == 'C' && m[3] == 'O' && m[4] == 'L')
                     {
                         r->method = NGX_HTTP_MKCOL;
                     }
+                    break;
 
-                } else if (p - m == 6) {
-
+                case 6:
                     if (m[0] == 'D' && m[1] == 'E' && m[2] == 'L'
                         && m[3] == 'E' && m[4] == 'T' && m[5] == 'E')
                     {
                         r->method = NGX_HTTP_DELETE;
                     }
+                    break;
                 }
 
                 state = sw_spaces_before_uri;
index 6bbaf446ab1a8e9a4d37bfaab3936950317c0b71..615ae7511d223bf95685ad74e360b2541a59f404 100644 (file)
@@ -1218,7 +1218,9 @@ ngx_http_process_request_header(ngx_http_request_t *r)
         }
     }
 
-    if (r->method == NGX_HTTP_POST && r->headers_in.content_length_n == -1) {
+    if (r->method & (NGX_HTTP_POST|NGX_HTTP_PUT)
+        && r->headers_in.content_length_n == -1)
+    {
         ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
                   "client sent POST method without \"Content-Length\" header");
         ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED);
@@ -1432,7 +1434,6 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
         }
 
         ngx_http_finalize_request(r, ngx_http_special_response_handler(r, rc));
-
         return;
     }
 
@@ -2154,19 +2155,11 @@ ngx_http_post_action(ngx_http_request_t *r)
 static void
 ngx_http_close_request(ngx_http_request_t *r, ngx_int_t error)
 {
-    ngx_connection_t    *c;
-    ngx_http_cleanup_t  *cln;
+    ngx_connection_t  *c;
 
     c = r->connection;
-    r = r->main;
-
-    for (cln = r->cleanup; cln; cln = cln->next) {
-        if (cln->handler) {
-            cln->handler(cln->data);
-        }
-    }
 
-    ngx_http_request_done(r, error);
+    ngx_http_request_done(r->main, error);
     ngx_http_close_connection(c);
 }
 
@@ -2177,6 +2170,7 @@ ngx_http_request_done(ngx_http_request_t *r, ngx_int_t error)
     ngx_log_t                  *log;
     ngx_uint_t                  i, n;
     struct linger               linger;
+    ngx_http_cleanup_t         *cln;
     ngx_http_log_ctx_t         *ctx;
     ngx_http_handler_pt        *log_handler;
     ngx_http_core_loc_conf_t   *clcf;
@@ -2191,6 +2185,12 @@ ngx_http_request_done(ngx_http_request_t *r, ngx_int_t error)
         return;
     }
 
+    for (cln = r->cleanup; cln; cln = cln->next) {
+        if (cln->handler) {
+            cln->handler(cln->data);
+        }
+    }
+
 #if (NGX_STAT_STUB)
 
     if (r->stat_reading) {
index 66df1bbe441b5e1058d266136a262e075fec9571..f7f831fdb96efedf4a4d7fb2e9aa2949f2704335 100644 (file)
@@ -13,8 +13,9 @@
 ngx_int_t
 ngx_shm_alloc(ngx_shm_t *shm)
 {
-    shm->addr = mmap(NULL, shm->size,
-                     PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
+    shm->addr = (u_char *) mmap(NULL, shm->size,
+                                PROT_READ|PROT_WRITE,
+                                MAP_ANON|MAP_SHARED, -1, 0);
 
     if (shm->addr == MAP_FAILED) {
         ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno,
@@ -29,7 +30,7 @@ ngx_shm_alloc(ngx_shm_t *shm)
 void
 ngx_shm_free(ngx_shm_t *shm)
 {
-    if (munmap(shm->addr, shm->size) == -1) {
+    if (munmap((void *) shm->addr, shm->size) == -1) {
         ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno,
                       "munmap(%p, %uz) failed", shm->addr, shm->size);
     }
@@ -50,7 +51,8 @@ ngx_shm_alloc(ngx_shm_t *shm)
         return NGX_ERROR;
     }
 
-    shm->addr = mmap(NULL, shm->size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+    shm->addr = (u_char *) mmap(NULL, shm->size, PROT_READ|PROT_WRITE,
+                                MAP_SHARED, fd, 0);
 
     if (shm->addr == MAP_FAILED) {
         ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno,
@@ -69,7 +71,7 @@ ngx_shm_alloc(ngx_shm_t *shm)
 void
 ngx_shm_free(ngx_shm_t *shm)
 {
-    if (munmap(shm->addr, shm->size) == -1) {
+    if (munmap((void *) shm->addr, shm->size) == -1) {
         ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno,
                       "munmap(%p, %uz) failed", shm->addr, shm->size);
     }