changeset 4204:657aaedcc0e3

Fixed two minor bugs in "types" parsing code.
author Ruslan Ermilov <ru@nginx.com>
date Wed, 12 Oct 2011 09:36:21 +0000
parents a949b15df739
children 26c307b8dc3c
files src/http/ngx_http_core_module.c
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -2994,6 +2994,12 @@ ngx_http_core_type(ngx_conf_t *cf, ngx_c
     value = cf->args->elts;
 
     if (ngx_strcmp(value[0].data, "include") == 0) {
+        if (cf->args->nelts != 2) {
+            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+                               "invalid number of arguments"
+                               " in \"include\" directive");
+            return NGX_CONF_ERROR;
+        }
         file = value[1];
 
         if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) {
@@ -3027,7 +3033,7 @@ ngx_http_core_type(ngx_conf_t *cf, ngx_c
                                    "content type: \"%V\", "
                                    "previous content type: \"%V\"",
                                    &value[i], content_type, old);
-                continue;
+                goto next;
             }
         }
 
@@ -3040,6 +3046,9 @@ ngx_http_core_type(ngx_conf_t *cf, ngx_c
         type->key = value[i];
         type->key_hash = hash;
         type->value = content_type;
+
+    next:
+        continue;
     }
 
     return NGX_CONF_OK;