@@ -1545,20 +1545,25 @@ ngx_stream_upsync_etcd_parse_json(void *data)
1545
1545
static ngx_int_t
1546
1546
ngx_stream_upsync_check_key (u_char * key , ngx_str_t host )
1547
1547
{
1548
- u_char * last , * ip_p , * port_p , * s_p ;
1548
+ u_char * last , * ip_p , * port_p , * u_p , * s_p ;
1549
1549
ngx_int_t port ;
1550
1550
1551
- s_p = (u_char * )ngx_strrchr (key , '/' );
1552
- if (s_p == NULL ) {
1551
+ u_p = (u_char * )ngx_strstr (key , host . data );
1552
+ if (u_p == NULL ) {
1553
1553
ngx_log_error (NGX_LOG_ERR , ngx_cycle -> log , 0 ,
1554
- "upsync_parse_json: %s key format is illegal, "
1555
- "contains no slash ('/') " , key );
1554
+ "upsync_parse_json: %s is illegal, "
1555
+ "dont contains upstream name %V " , key , & host );
1556
1556
return NGX_ERROR ;
1557
1557
}
1558
- if (* (s_p - host .len - 1 ) != '/' ) {
1558
+ if (* (u_p + host .len ) != '/' || * ( u_p - 1 ) != '/' ) {
1559
1559
return NGX_ERROR ;
1560
1560
}
1561
- if (ngx_strncmp ((s_p - host .len ), host .data , host .len ) != 0 ) {
1561
+
1562
+ s_p = (u_char * )ngx_strrchr (key , '/' );
1563
+ if (s_p == NULL ) {
1564
+ ngx_log_error (NGX_LOG_ERR , ngx_cycle -> log , 0 ,
1565
+ "upsync_parse_json: %s key format is illegal, "
1566
+ "contains no slash ('/')" , key );
1562
1567
return NGX_ERROR ;
1563
1568
}
1564
1569
0 commit comments