Ver código fonte

Added detection of HTTP 413 errors

Addition of a header filter to track HTTP errors and return
the right status to upload progress probes.
tags/v0.3
Brice Figureau 18 anos atrás
pai
commit
004131f404
2 arquivos alterados com 12 adições e 4 exclusões
  1. 1
    1
      config
  2. 11
    3
      ngx_http_uploadprogress_module.c

+ 1
- 1
config Ver arquivo

@@ -1,3 +1,3 @@
1 1
 ngx_addon_name=ngx_http_uploadprogress_module
2
-HTTP_MODULES="$HTTP_MODULES ngx_http_uploadprogress_module"
2
+HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES ngx_http_uploadprogress_module"
3 3
 NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_uploadprogress_module.c"

+ 11
- 3
ngx_http_uploadprogress_module.c Ver arquivo

@@ -773,8 +773,8 @@ ngx_http_uploadprogress_errortracker(ngx_http_request_t *r)
773 773
     	upcf = ngx_http_get_module_loc_conf(r, ngx_http_uploadprogress_module);
774 774
 
775 775
 		  if (!upcf->track) {
776
-			  	ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
777
-			                 "uploadprogress error-tracker not tracking in this location for id: %V", id);
776
+			  	ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
777
+			                 "uploadprogress error-tracker not tracking in this location");
778 778
 		    goto finish;
779 779
 		  }
780 780
 
@@ -854,9 +854,17 @@ ngx_http_uploadprogress_errortracker(ngx_http_request_t *r)
854 854
 		  upcln->shm_zone = upcf->shm_zone;
855 855
 		  upcln->node = node;
856 856
 
857
+			/* start the timer if needed */
858
+			if ( !upcf->cleanup.timer_set)
859
+			{
860
+				upcf->cleanup.data = upcf->shm_zone;
861
+				upcf->cleanup.handler = ngx_clean_old_connections;
862
+				upcf->cleanup.log = r->connection->log;
863
+				ngx_add_timer(&upcf->cleanup, 60 * 1000);
864
+			}
865
+
857 866
 		  ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
858 867
 		                 "trackuploads error-tracking adding: %08XD", node->key);
859
-
860 868
 		}
861 869
 
862 870
 finish:		

Carregando…
Cancelar
Salvar