@@ -373,7 +373,7 @@ ngx_http_proxy_connect_test_connect(ngx_connection_t *c)
373
373
374
374
c -> log -> action = "connecting to upstream" ;
375
375
(void ) ngx_connection_error (c , err ,
376
- "kevent() reported that connect() failed" );
376
+ "proxy_connet: upstream connect failed (kevent) " );
377
377
return NGX_ERROR ;
378
378
}
379
379
@@ -395,8 +395,9 @@ ngx_http_proxy_connect_test_connect(ngx_connection_t *c)
395
395
}
396
396
397
397
if (err ) {
398
- c -> log -> action = "connecting to upstream (proxy_connect)" ;
399
- (void ) ngx_connection_error (c , err , "connect() failed" );
398
+ c -> log -> action = "connecting to upstream" ;
399
+ (void ) ngx_connection_error (c , err ,
400
+ "proxy_connect: upstream connect failed" );
400
401
return NGX_ERROR ;
401
402
}
402
403
}
@@ -740,7 +741,8 @@ ngx_http_proxy_connect_read_downstream(ngx_http_request_t *r)
740
741
741
742
if (r -> connection -> read -> timedout ) {
742
743
r -> connection -> timedout = 1 ;
743
- ngx_connection_error (r -> connection , NGX_ETIMEDOUT , "client timed out" );
744
+ ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 ,
745
+ "proxy_connect: client read timed out" );
744
746
ngx_http_proxy_connect_finalize_request (r , ctx -> u ,
745
747
NGX_HTTP_REQUEST_TIME_OUT );
746
748
return ;
@@ -759,7 +761,8 @@ ngx_http_proxy_connect_write_downstream(ngx_http_request_t *r)
759
761
760
762
if (r -> connection -> write -> timedout ) {
761
763
r -> connection -> timedout = 1 ;
762
- ngx_connection_error (r -> connection , NGX_ETIMEDOUT , "client timed out" );
764
+ ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 ,
765
+ "proxy_connect: client write timed out" );
763
766
ngx_http_proxy_connect_finalize_request (r , ctx -> u ,
764
767
NGX_HTTP_REQUEST_TIME_OUT );
765
768
return ;
@@ -784,7 +787,9 @@ ngx_http_proxy_connect_read_upstream(ngx_http_request_t *r,
784
787
c = u -> peer .connection ;
785
788
786
789
if (c -> read -> timedout ) {
787
- ngx_connection_error (c , NGX_ETIMEDOUT , "upstream timed out" );
790
+ ngx_log_error (NGX_LOG_ERR , c -> log , 0 ,
791
+ "proxy_connect: upstream read timed out (peer:%V)" ,
792
+ u -> peer .name );
788
793
ngx_http_proxy_connect_finalize_request (r , u , NGX_HTTP_GATEWAY_TIME_OUT );
789
794
return ;
790
795
}
@@ -837,8 +842,9 @@ ngx_http_proxy_connect_write_upstream(ngx_http_request_t *r,
837
842
"proxy_connect upstream write handler" );
838
843
839
844
if (c -> write -> timedout ) {
840
- ngx_connection_error (c , NGX_ETIMEDOUT ,
841
- "upstream timed out (proxy_connect)" );
845
+ ngx_log_error (NGX_LOG_ERR , c -> log , 0 ,
846
+ "proxy_connect: upstream %s timed out (peer:%V)" ,
847
+ u -> connected ? "write" : "connect" , u -> peer .name );
842
848
ngx_http_proxy_connect_finalize_request (r , u ,
843
849
NGX_HTTP_GATEWAY_TIME_OUT );
844
850
return ;
@@ -890,8 +896,8 @@ ngx_http_proxy_connect_send_handler(ngx_http_request_t *r)
890
896
891
897
if (c -> write -> timedout ) {
892
898
c -> timedout = 1 ;
893
- ngx_connection_error ( c , NGX_ETIMEDOUT ,
894
- " client timed out (proxy_connect) " );
899
+ ngx_log_error ( NGX_LOG_ERR , c -> log , 0 ,
900
+ "proxy_connect: client write timed out" );
895
901
ngx_http_proxy_connect_finalize_request (r , ctx -> u ,
896
902
NGX_HTTP_REQUEST_TIME_OUT );
897
903
return ;
@@ -947,7 +953,7 @@ ngx_http_proxy_connect_process_connect(ngx_http_request_t *r,
947
953
948
954
ctx = ngx_http_get_module_ctx (r , ngx_http_proxy_connect_module );
949
955
950
- r -> connection -> log -> action = "connecting to upstream (proxy_connect) " ;
956
+ r -> connection -> log -> action = "connecting to upstream" ;
951
957
952
958
if (ngx_http_proxy_connect_set_local (r , u , u -> conf -> local ) != NGX_OK ) {
953
959
ngx_http_proxy_connect_finalize_request (r , u , NGX_HTTP_INTERNAL_SERVER_ERROR );
@@ -975,13 +981,15 @@ ngx_http_proxy_connect_process_connect(ngx_http_request_t *r,
975
981
}
976
982
977
983
if (rc == NGX_BUSY ) {
978
- ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 , "no live connection" );
984
+ ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 ,
985
+ "proxy_connect: no live connection" );
979
986
ngx_http_proxy_connect_finalize_request (r , u , NGX_HTTP_BAD_GATEWAY );
980
987
return ;
981
988
}
982
989
983
990
if (rc == NGX_DECLINED ) {
984
- ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 , "connection error" );
991
+ ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 ,
992
+ "proxy_connect: connection error" );
985
993
ngx_http_proxy_connect_finalize_request (r , u , NGX_HTTP_BAD_GATEWAY );
986
994
return ;
987
995
}
@@ -1046,7 +1054,7 @@ ngx_http_proxy_connect_resolve_handler(ngx_resolver_ctx_t *ctx)
1046
1054
1047
1055
if (ctx -> state ) {
1048
1056
ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 ,
1049
- "%V could not be resolved (%i: %s)" ,
1057
+ "proxy_connect: %V could not be resolved (%i: %s)" ,
1050
1058
& ctx -> name , ctx -> state ,
1051
1059
ngx_resolver_strerror (ctx -> state ));
1052
1060
@@ -1403,12 +1411,13 @@ ngx_http_proxy_connect_handler(ngx_http_request_t *r)
1403
1411
url .no_resolve = 1 ;
1404
1412
1405
1413
ngx_log_debug1 (NGX_LOG_DEBUG_HTTP , r -> connection -> log , 0 ,
1406
- "connect handler: parse url: %V" , & url );
1414
+ "connect handler: parse url: %V" , & url . url );
1407
1415
1408
1416
if (ngx_parse_url (r -> pool , & url ) != NGX_OK ) {
1409
1417
if (url .err ) {
1410
1418
ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 ,
1411
- "%s in connect host \"%V\"" , url .err , & url .url );
1419
+ "proxy_connect: %s in connect host \"%V\"" ,
1420
+ url .err , & url .url );
1412
1421
return NGX_HTTP_FORBIDDEN ;
1413
1422
}
1414
1423
@@ -1469,13 +1478,14 @@ ngx_http_proxy_connect_handler(ngx_http_request_t *r)
1469
1478
rctx = ngx_resolve_start (clcf -> resolver , & temp );
1470
1479
if (rctx == NULL ) {
1471
1480
ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 ,
1472
- "failed to start the resolver" );
1481
+ "proxy_connect: failed to start the resolver" );
1473
1482
return NGX_HTTP_INTERNAL_SERVER_ERROR ;
1474
1483
}
1475
1484
1476
1485
if (rctx == NGX_NO_RESOLVER ) {
1477
1486
ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 ,
1478
- "no resolver defined to resolve %V" , & r -> connect_host );
1487
+ "proxy_connect: no resolver defined to resolve %V" ,
1488
+ & r -> connect_host );
1479
1489
return NGX_HTTP_BAD_GATEWAY ;
1480
1490
}
1481
1491
@@ -1797,7 +1807,7 @@ ngx_http_proxy_connect_set_local(ngx_http_request_t *r,
1797
1807
1798
1808
if (rc != NGX_OK ) {
1799
1809
ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 ,
1800
- "invalid local address \"%V\"" , & val );
1810
+ "proxy_connect: invalid local address \"%V\"" , & val );
1801
1811
return NGX_OK ;
1802
1812
}
1803
1813
@@ -1960,7 +1970,8 @@ ngx_http_proxy_connect_variable_set_time(ngx_http_request_t *r,
1960
1970
1961
1971
if (ms == (ngx_msec_t ) NGX_ERROR ) {
1962
1972
ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 ,
1963
- "[proxy_connect] invalid msec \"%V\" (ctx offset=%ui)" , & s , data );
1973
+ "proxy_connect: invalid msec \"%V\" (ctx offset=%ui)" ,
1974
+ & s , data );
1964
1975
return ;
1965
1976
}
1966
1977
@@ -1969,7 +1980,7 @@ ngx_http_proxy_connect_variable_set_time(ngx_http_request_t *r,
1969
1980
if (ctx == NULL ) {
1970
1981
#if 0
1971
1982
ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 ,
1972
- "[ proxy_connect] no ctx found" );
1983
+ "proxy_connect: no ctx found" );
1973
1984
#endif
1974
1985
return ;
1975
1986
}
0 commit comments