ПРОЕКТЫ 


  АРХИВ 


Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


  СТАТЬИ 


  ПЕРСОНАЛЬНОЕ 


  ПРОГРАММЫ 



ПИШИТЕ
ПИСЬМА












     АРХИВ :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: post_action status



Понял, спасибо за коррективы, надеюсь включите эти мелкие исправления в следующий релиз.
Пока применяю этот патч руками.
On 03/12/2012 10:38 AM, Maxim Dounin wrote:
Hello!

On Mon, Mar 12, 2012 at 10:07:55AM -0700, Roman Vasilyev wrote:

поправил немного
diff -Naur nginx-1.1.16.old nginx-1.1.16
--- nginx-1.1.16.old/src/http/modules/ngx_http_uwsgi_module.c   2012-01-18 
07:07:43.000000000 -0800
+++ nginx-1.1.16/src/http/modules/ngx_http_uwsgi_module.c       2012-03-12 
10:02:13.180557183 -0700
@@ -43,7 +43,6 @@
  static ngx_int_t ngx_http_uwsgi_reinit_request(ngx_http_request_t *r);
  static ngx_int_t ngx_http_uwsgi_process_status_line(ngx_http_request_t *r);
  static ngx_int_t ngx_http_uwsgi_process_header(ngx_http_request_t *r);
-static ngx_int_t ngx_http_uwsgi_process_header(ngx_http_request_t *r);
  static void ngx_http_uwsgi_abort_request(ngx_http_request_t *r);
  static void ngx_http_uwsgi_finalize_request(ngx_http_request_t *r,
      ngx_int_t rc);
@@ -912,10 +911,7 @@
      }

      if (rc == NGX_ERROR) {
-        r->http_version = NGX_HTTP_VERSION_9;
-
          u->process_header = ngx_http_uwsgi_process_header;
-
          return ngx_http_uwsgi_process_header(r);
      }

@@ -951,7 +947,6 @@
      ngx_str_t                      *status_line;
      ngx_int_t                       rc, status;
      ngx_table_elt_t                *h;
-    ngx_http_upstream_t            *u;
      ngx_http_upstream_header_t     *hh;
      ngx_http_upstream_main_conf_t  *umcf;

@@ -1009,18 +1004,17 @@
          }

          if (rc == NGX_HTTP_PARSE_HEADER_DONE) {
+            ngx_http_upstream_t  *u = r->upstream;

              /* a whole header has been parsed successfully */

              ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                             "http uwsgi header done");

-            if (r->http_version>  NGX_HTTP_VERSION_9) {
+            if (r->http_version>  NGX_HTTP_VERSION_9&&  
u->headers_in.status_n) {
                  return NGX_OK;
              }
Проверка на http_version тут не нужна вообще, а вынос определения
переменой u внутрь if'а - это style bug (не говоря уже о том, что
модули scgi и uwsgi следует сохранять минимально отличающимися).  Но
в целом должно работать.

У меня какой-то такой патч:

# HG changeset patch
# User Maxim Dounin<mdounin@xxxxxxxxxx>
# Date 1331573481 -14400
# Node ID 36bd6a3561882bd8acd13f053f35d0ed1563e11d
# Parent  deba4989d0b6b2dfffe303cda29538644a92b558
Uwsgi: merged r->http_version fixes from scgi module.

Fixed incorrect use of r->http_version (r4372).  Removed duplicate function
declaration (r4373).  Removed error if there is no Status header (r4374).

diff --git a/src/http/modules/ngx_http_uwsgi_module.c 
b/src/http/modules/ngx_http_uwsgi_module.c
--- a/src/http/modules/ngx_http_uwsgi_module.c
+++ b/src/http/modules/ngx_http_uwsgi_module.c
@@ -43,7 +43,6 @@ static ngx_int_t ngx_http_uwsgi_create_r
  static ngx_int_t ngx_http_uwsgi_reinit_request(ngx_http_request_t *r);
  static ngx_int_t ngx_http_uwsgi_process_status_line(ngx_http_request_t *r);
  static ngx_int_t ngx_http_uwsgi_process_header(ngx_http_request_t *r);
-static ngx_int_t ngx_http_uwsgi_process_header(ngx_http_request_t *r);
  static void ngx_http_uwsgi_abort_request(ngx_http_request_t *r);
  static void ngx_http_uwsgi_finalize_request(ngx_http_request_t *r,
      ngx_int_t rc);
@@ -912,10 +911,7 @@ ngx_http_uwsgi_process_status_line(ngx_h
      }

      if (rc == NGX_ERROR) {
-        r->http_version = NGX_HTTP_VERSION_9;
-
          u->process_header = ngx_http_uwsgi_process_header;
-
          return ngx_http_uwsgi_process_header(r);
      }

@@ -1015,12 +1011,12 @@ ngx_http_uwsgi_process_header(ngx_http_r
              ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                             "http uwsgi header done");

-            if (r->http_version>  NGX_HTTP_VERSION_9) {
+            u = r->upstream;
+
+            if (u->headers_in.status_n) {
                  return NGX_OK;
              }

-            u = r->upstream;
-
              if (u->headers_in.status) {
                  status_line =&u->headers_in.status->value;

@@ -1032,20 +1028,15 @@ ngx_http_uwsgi_process_header(ngx_http_r
                      return NGX_HTTP_UPSTREAM_INVALID_HEADER;
                  }

-                r->http_version = NGX_HTTP_VERSION_10;
                  u->headers_in.status_n = status;
                  u->headers_in.status_line = *status_line;

              } else if (u->headers_in.location) {
-                r->http_version = NGX_HTTP_VERSION_10;
                  u->headers_in.status_n = 302;
                  ngx_str_set(&u->headers_in.status_line,
                              "302 Moved Temporarily");

              } else {
-                ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
-                              "upstream sent neither valid HTTP/1.0 header "
-                              "nor \"Status\" header line");
                  u->headers_in.status_n = 200;
                  ngx_str_set(&u->headers_in.status_line, "200 OK");
              }


Maxim Dounin

_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru

_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru


 




Copyright © Lexa Software, 1996-2009.