diff src/http/modules/ngx_http_limit_req_module.c @ 506:e8b686f230a8 NGINX_0_8_5

nginx 0.8.5 *) Bugfix: now nginx allows underscores in a request method. *) Bugfix: a 500 error code was returned for invalid login/password while HTTP Basic authentication on Windows. *) Bugfix: ngx_http_perl_module responses did not work in subrequests. *) Bugfix: in ngx_http_limit_req_module. Thanks to Maxim Dounin.
author Igor Sysoev <http://sysoev.ru>
date Mon, 13 Jul 2009 00:00:00 +0400
parents f39b9e29530d
children f7ec98e3caeb
line wrap: on
line diff
--- a/src/http/modules/ngx_http_limit_req_module.c
+++ b/src/http/modules/ngx_http_limit_req_module.c
@@ -181,7 +181,7 @@ ngx_http_limit_req_handler(ngx_http_requ
     }
 
     ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
-                  "limit_req: %i %ui.%03ui", rc, excess / 1000, excess % 1000);
+                   "limit_req: %i %ui.%03ui", rc, excess / 1000, excess % 1000);
 
     if (rc == NGX_BUSY) {
         ngx_shmtx_unlock(&ctx->shpool->mutex);
@@ -263,8 +263,23 @@ done:
 static void
 ngx_http_limit_req_delay(ngx_http_request_t *r)
 {
+    ngx_event_t  *wev;
+
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
-                  "limit_req delay");
+                   "limit_req delay");
+
+    wev = r->connection->write;
+
+    if (!wev->timedout) {
+
+        if (ngx_handle_write_event(wev, 0) != NGX_OK) {
+            ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+        }
+
+        return;
+    }
+
+    wev->timedout = 0;
 
     if (ngx_handle_read_event(r->connection->read, 0) != NGX_OK) {
         ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);