Преглед на файлове

fixing hard crash in case of client disconnection

tags/v0.4
Brice Figureau преди 18 години
родител
ревизия
e04c8ad884
променени са 1 файла, в които са добавени 14 реда и са изтрити 1 реда
  1. 14
    1
      ngx_http_uploadprogress_module.c

+ 14
- 1
ngx_http_uploadprogress_module.c Целия файл

@@ -274,6 +274,7 @@ ngx_http_uploadprogress_content_handler(ngx_http_request_t *r)
274 274
 
275 275
 static void ngx_http_uploadprogress_event_handler(ngx_http_request_t *r)
276 276
 {
277
+  ngx_int_t  rc;
277 278
     ngx_str_t                       *id;
278 279
     ngx_slab_pool_t                 *shpool;
279 280
     ngx_http_uploadprogress_ctx_t   *ctx;
@@ -284,7 +285,19 @@ static void ngx_http_uploadprogress_event_handler(ngx_http_request_t *r)
284 285
     
285 286
     /* call the original read event handler */
286 287
     upcf = ngx_http_get_module_loc_conf(r, ngx_http_uploadprogress_module);
287
-    upcf->read_event_handler(r);
288
+ 
289
+    if (r->connection->read->timedout) {
290
+        r->connection->timedout = 1;
291
+        ngx_http_finalize_request(r, NGX_HTTP_REQUEST_TIME_OUT);
292
+        return;
293
+    }
294
+
295
+    rc = ngx_http_do_read_client_request_body(r);
296
+
297
+    if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
298
+        ngx_http_finalize_request(r, rc);
299
+				return;
300
+    }
288 301
 
289 302
     /* find node, update rest */
290 303
     id = get_tracking_id(r);

Loading…
Отказ
Запис