Skip to content

Commit 3996722

Browse files
committed
Merge pull request #4 from senthilkumar-kj/master
add log message when keys do not contain '/'
2 parents 15abeec + 1cb7bf2 commit 3996722

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/ngx_stream_upsync_module.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,12 @@ ngx_stream_upsync_consul_parse_json(void *data)
11551155
cJSON *temp1 = cJSON_GetObjectItem(server_next, "Key");
11561156
if (temp1 != NULL && temp1->valuestring != NULL) {
11571157
p = (u_char *)ngx_strrchr(temp1->valuestring, '/');
1158-
if (p == NULL || ngx_stream_upsync_check_key(p) != NGX_OK) {
1158+
if (p == NULL) {
1159+
ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0,
1160+
"upsync_parse_json: %s key format is illegal, "
1161+
"contains no slash ('/')", temp1->valuestring);
1162+
continue;
1163+
} else if (ngx_stream_upsync_check_key(p) != NGX_OK) {
11591164
continue;
11601165
}
11611166

@@ -1389,7 +1394,12 @@ ngx_stream_upsync_etcd_parse_json(void *data)
13891394
cJSON *temp0 = cJSON_GetObjectItem(server_next, "key");
13901395
if (temp0 != NULL && temp0->valuestring != NULL) {
13911396
p = (u_char *)ngx_strrchr(temp0->valuestring, '/');
1392-
if (p == NULL || ngx_stream_upsync_check_key(p) != NGX_OK) {
1397+
if (p == NULL) {
1398+
ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0,
1399+
"upsync_parse_json: %s key format is illegal, "
1400+
"contains no slash ('/')", temp0->valuestring);
1401+
continue;
1402+
} else if (ngx_stream_upsync_check_key(p) != NGX_OK) {
13931403
continue;
13941404
}
13951405

0 commit comments

Comments
 (0)