]> git.kaiwu.me - nginx.git/commitdiff
log proxied HTTP/0.9 responses status as "009"
authorIgor Sysoev <igor@sysoev.ru>
Sun, 29 Nov 2009 20:49:29 +0000 (20:49 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Sun, 29 Nov 2009 20:49:29 +0000 (20:49 +0000)
src/http/modules/ngx_http_log_module.c
src/http/modules/ngx_http_proxy_module.c

index 4ea7682f5142968adb3bcca3ce29952369f8800b..0752d0394fe3e8ba696f346be6e150794f787e52 100644 (file)
@@ -542,8 +542,25 @@ ngx_http_log_request_time(ngx_http_request_t *r, u_char *buf,
 static u_char *
 ngx_http_log_status(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op)
 {
-    return ngx_sprintf(buf, "%ui",
-                       r->err_status ? r->err_status : r->headers_out.status);
+    ngx_uint_t  status;
+
+    if (r->err_status) {
+        status = r->err_status;
+
+    } else if (r->headers_out.status) {
+        status = r->headers_out.status;
+
+    } else if (r->http_version == NGX_HTTP_VERSION_9) {
+        *buf++ = '0';
+        *buf++ = '0';
+        *buf++ = '9';
+        return buf;
+
+    } else {
+        status = 0;
+    }
+
+    return ngx_sprintf(buf, "%ui", status);
 }
 
 
index e0f17e70ac26665a608652697b0d90e6d462961d..3e0588f904489a13c2ce339021cbff267c4cdf59 100644 (file)
@@ -1230,7 +1230,6 @@ ngx_http_proxy_process_status_line(ngx_http_request_t *r)
 
         if (r->cache) {
             r->http_version = NGX_HTTP_VERSION_9;
-            u->headers_in.status_n = NGX_HTTP_OK;
             return NGX_OK;
         }
 
@@ -1246,7 +1245,6 @@ ngx_http_proxy_process_status_line(ngx_http_request_t *r)
 #endif
 
         r->http_version = NGX_HTTP_VERSION_9;
-        u->headers_in.status_n = NGX_HTTP_OK;
         u->state->status = NGX_HTTP_OK;
 
         return NGX_OK;