Bläddra i källkod

* version 0.3

* added new CHANGES
* support for lowercase or mixed case X-Progress-ID header or parameter (fixes IE lowercasing headers)
* report original HTTP error code in probe in case of upload error
* fix crash reported by Michal Drapiewski
tags/v0.3
Brice Figureau 18 år sedan
förälder
incheckning
0692559861
2 ändrade filer med 29 tillägg och 19 borttagningar
  1. 11
    0
      CHANGES
  2. 18
    19
      ngx_http_uploadprogress_module.c

+ 11
- 0
CHANGES Visa fil

@@ -1,3 +1,14 @@
1
+nginx_upload_progress release 0.3                                  06 May 2008
2
+
3
+ * fixed crash if the upload was denied by nginx because of any error
4
+   condition (thanks to Michal Drapiewski for his detailed report)
5
+	 
6
+ * report original upload error condition to client in the upload progress 
7
+   probe
8
+ 
9
+ * case-insensitive checking of the X-Progress-ID header to overcome Internet
10
+   Explorer XMLHttpRequest issue.
11
+
1 12
 nginx_upload_progress release 0.2                                  10 Oct 2007
2 13
 
3 14
  * the system now remembers old active uploads for 1 minute to be

+ 18
- 19
ngx_http_uploadprogress_module.c Visa fil

@@ -387,12 +387,12 @@ ngx_http_reportuploads_handler(ngx_http_request_t * r)
387 387
     }
388 388
 
389 389
     if (orig == NULL || orig->request_body == NULL) {
390
-        if (up != NULL && up->err_status != NGX_HTTP_REQUEST_ENTITY_TOO_LARGE) {
391
-            size = sizeof("new Object({ 'state' : 'done' })\r\n");
392
-        } else if (up != NULL && up->err_status == NGX_HTTP_REQUEST_ENTITY_TOO_LARGE) {
393
-            size = sizeof("new Object({ 'state' : 'error', 'status' : 413 })\r\n");
394
-        } else {
390
+        if (up == NULL ) {
395 391
             size = sizeof("new Object({ 'state' : 'starting' })\r\n");
392
+        } else if (up != NULL && up->err_status >= NGX_HTTP_SPECIAL_RESPONSE) {
393
+            size = sizeof("new Object({ 'state' : 'error', 'status' : ") + NGX_INT_T_LEN + sizeof(" })\r\n");
394
+        } else {
395
+            size = sizeof("new Object({ 'state' : 'done' })\r\n");
396 396
         }
397 397
     } else if (orig->err_status == NGX_HTTP_REQUEST_ENTITY_TOO_LARGE) {
398 398
         size = sizeof("new Object({ 'state' : 'error', 'status' : 413 })\r\n");
@@ -418,21 +418,20 @@ ngx_http_reportuploads_handler(ngx_http_request_t * r)
418 418
                                  1);
419 419
             ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
420 420
                            "reportuploads returning starting");
421
-        } else if (up != NULL && up->err_status == NGX_HTTP_REQUEST_ENTITY_TOO_LARGE) {
422
-            b->last =
423
-                ngx_cpymem(b->last,
424
-                           "new Object({ 'state' : 'error', 'status' : 413 })\r\n",
425
-                           sizeof
426
-                           ("new Object({ 'state' : 'error', 'status' : 413 })\r\n")
427
-                           - 1);
428
-            ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
429
-                           "reportuploads returning error 413");
430
-        } else {
421
+        } else if (up != NULL && up->err_status >= NGX_HTTP_SPECIAL_RESPONSE) {
422
+            b->last = ngx_cpymem(b->last, "new Object({ 'state' : 'error', 'status' : ",
423
+                                   sizeof("new Object({ 'state' : 'error', 'status' : ") - 1);
424
+        		b->last =	ngx_sprintf(b->last, "%ui })\r\n", up->err_status );
425
+            ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
426
+                           "reportuploads returning error condition: %ui", up->err_status);
427
+        }
428
+				else {
431 429
             b->last = ngx_cpymem(b->last, "new Object({ 'state' : 'done' })\r\n",
432
-                                 sizeof("new Object({ 'state' : 'done' })\r\n") - 1);
430
+                                   sizeof("new Object({ 'state' : 'done' })\r\n") -
431
+                                 1);
433 432
             ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
434 433
                            "reportuploads returning done");
435
-        }
434
+				}
436 435
     } else if (orig->err_status == NGX_HTTP_REQUEST_ENTITY_TOO_LARGE) {
437 436
         b->last =
438 437
             ngx_cpymem(b->last,
@@ -445,7 +444,7 @@ ngx_http_reportuploads_handler(ngx_http_request_t * r)
445 444
     } else {
446 445
         b->last =
447 446
             ngx_cpymem(b->last, "new Object({ 'state' : 'uploading', 'received' : ",
448
-                       sizeof("new Object({ 'state' : 'uploading', 'received' : ") -
447
+                         sizeof("new Object({ 'state' : 'uploading', 'received' : ") -
449 448
                        1);
450 449
 
451 450
         b->last =
@@ -795,7 +794,7 @@ ngx_http_uploadprogress_errortracker(ngx_http_request_t * r)
795 794
 
796 795
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
797 796
                    "uploadprogress error-tracker error: %D", r->err_status);
798
-    if (r->err_status == NGX_HTTP_REQUEST_ENTITY_TOO_LARGE) {
797
+    if (r->err_status >= NGX_HTTP_SPECIAL_RESPONSE) {
799 798
 
800 799
         upcf = ngx_http_get_module_loc_conf(r, ngx_http_uploadprogress_module);
801 800
 

Laddar…
Avbryt
Spara