diff src/http/ngx_http_core_module.c @ 6948:3fb9b5eb75c0

Fixed ngx_open_cached_file() error handling. If of.err is 0, it means that there was a memory allocation error and no further logging and/or processing is needed. The of.failed string can be only accessed if of.err is not 0.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 28 Mar 2017 14:21:38 +0300
parents 6e20a6479325
children 99934aade555
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1314,6 +1314,11 @@ ngx_http_core_try_files_phase(ngx_http_r
         if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
             != NGX_OK)
         {
+            if (of.err == 0) {
+                ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+                return NGX_OK;
+            }
+
             if (of.err != NGX_ENOENT
                 && of.err != NGX_ENOTDIR
                 && of.err != NGX_ENAMETOOLONG)