File tree Expand file tree Collapse file tree 2 files changed +51
-4
lines changed Expand file tree Collapse file tree 2 files changed +51
-4
lines changed Original file line number Diff line number Diff line change @@ -644,6 +644,15 @@ static ngx_int_t
644
644
ngx_http_srcache_store_post_subrequest (ngx_http_request_t * r , void * data ,
645
645
ngx_int_t rc )
646
646
{
647
+ if (rc == NGX_ERROR
648
+ || rc >= NGX_HTTP_SPECIAL_RESPONSE
649
+ || r -> headers_out .status >= NGX_HTTP_SPECIAL_RESPONSE )
650
+ {
651
+ ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 ,
652
+ "srcache_store subrequest failed: rc=%i status=%ui" ,
653
+ rc , r -> headers_out .status );
654
+ }
655
+
647
656
return NGX_OK ;
648
657
}
649
658
Original file line number Diff line number Diff line change @@ -547,8 +547,8 @@ finalize: 0
547
547
Content-Type: text/css
548
548
--- response_body
549
549
I do like you
550
- --- no_error_log
551
- [error]
550
+ --- error_log
551
+ srcache_store subrequest failed: rc=-1 status=0
552
552
553
553
554
554
@@ -600,8 +600,8 @@ finalize: 0
600
600
Content-Type: text/css
601
601
--- response_body
602
602
I do like you
603
- --- no_error_log
604
- [error]
603
+ --- error_log
604
+ srcache_store subrequest failed: rc=500 status=0,
605
605
606
606
607
607
@@ -629,3 +629,41 @@ srcache_fetch: cache sent truncated response body
629
629
--- no_error_log
630
630
[alert]
631
631
632
+
633
+
634
+ === TEST 18: store subrequest failure
635
+ --- http_config
636
+ upstream local {
637
+ server localhost:$TEST_NGINX_MEMCACHED_PORT;
638
+ }
639
+
640
+ --- config
641
+ memc_connect_timeout 100ms;
642
+ memc_send_timeout 100ms;
643
+ memc_read_timeout 100ms;
644
+
645
+ location = /memc {
646
+ internal;
647
+
648
+ set $memc_key $query_string;
649
+ set $memc_exptime 1d;
650
+ memc_pass local;
651
+ }
652
+
653
+ location = /tblah {
654
+ srcache_fetch GET /memc $uri;
655
+ srcache_store PUT /memc $uri;
656
+ proxy_pass http://127.0.0.1:$server_port/back;
657
+ }
658
+
659
+ location = /back {
660
+ echo ok;
661
+ }
662
+ --- request
663
+ GET /tblah
664
+ --- response_body
665
+ ok
666
+ --- error_log
667
+ variable "$memc_exptime" takes invalid value: 1d,
668
+ srcache_store subrequest failed: rc=400 status=0,
669
+
You can’t perform that action at this time.
0 commit comments