Procházet zdrojové kódy

fixing hard crash in case of client disconnection

tags/v0.4
Brice Figureau před 18 roky
rodič
revize
e04c8ad884
1 změnil soubory, kde provedl 14 přidání a 1 odebrání
  1. 14
    1
      ngx_http_uploadprogress_module.c

+ 14
- 1
ngx_http_uploadprogress_module.c Zobrazit soubor

@@ -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);

Načítá se…
Zrušit
Uložit