Просмотр исходного кода

fixing hard crash in case of client disconnection

tags/v0.4
Brice Figureau 18 лет назад
Родитель
Сommit
e04c8ad884
1 измененных файлов: 14 добавлений и 1 удалений
  1. 14
    1
      ngx_http_uploadprogress_module.c

+ 14
- 1
ngx_http_uploadprogress_module.c Просмотреть файл

274
 
274
 
275
 static void ngx_http_uploadprogress_event_handler(ngx_http_request_t *r)
275
 static void ngx_http_uploadprogress_event_handler(ngx_http_request_t *r)
276
 {
276
 {
277
+  ngx_int_t  rc;
277
     ngx_str_t                       *id;
278
     ngx_str_t                       *id;
278
     ngx_slab_pool_t                 *shpool;
279
     ngx_slab_pool_t                 *shpool;
279
     ngx_http_uploadprogress_ctx_t   *ctx;
280
     ngx_http_uploadprogress_ctx_t   *ctx;
284
     
285
     
285
     /* call the original read event handler */
286
     /* call the original read event handler */
286
     upcf = ngx_http_get_module_loc_conf(r, ngx_http_uploadprogress_module);
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
     /* find node, update rest */
302
     /* find node, update rest */
290
     id = get_tracking_id(r);
303
     id = get_tracking_id(r);

Загрузка…
Отмена
Сохранить