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

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 лет назад
Родитель
Сommit
004131f404
2 измененных файлов: 12 добавлений и 4 удалений
  1. 1
    1
      config
  2. 11
    3
      ngx_http_uploadprogress_module.c

+ 1
- 1
config Просмотреть файл

1
 ngx_addon_name=ngx_http_uploadprogress_module
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
 NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_uploadprogress_module.c"
3
 NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_uploadprogress_module.c"

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

773
     	upcf = ngx_http_get_module_loc_conf(r, ngx_http_uploadprogress_module);
773
     	upcf = ngx_http_get_module_loc_conf(r, ngx_http_uploadprogress_module);
774
 
774
 
775
 		  if (!upcf->track) {
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
 		    goto finish;
778
 		    goto finish;
779
 		  }
779
 		  }
780
 
780
 
854
 		  upcln->shm_zone = upcf->shm_zone;
854
 		  upcln->shm_zone = upcf->shm_zone;
855
 		  upcln->node = node;
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
 		  ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
866
 		  ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
858
 		                 "trackuploads error-tracking adding: %08XD", node->key);
867
 		                 "trackuploads error-tracking adding: %08XD", node->key);
859
-
860
 		}
868
 		}
861
 
869
 
862
 finish:		
870
 finish:		

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