TSG-21649 修复client_administrative_area字段乱码问题以及Edit Element处理多json问题
This commit is contained in:
@@ -658,6 +658,7 @@ finish:
|
||||
|
||||
size_t format_multidelete_json_type(const char * in, size_t in_sz, const struct edit_element_rule * rules, char** out)
|
||||
{
|
||||
int match=0;
|
||||
char *new_out=NULL, *pre_out=NULL;
|
||||
char * tmp = ALLOC(char, in_sz+1);
|
||||
char * token = NULL, * sub_token = NULL, * saveptr = NULL;
|
||||
@@ -685,10 +686,25 @@ size_t format_multidelete_json_type(const char * in, size_t in_sz, const struct
|
||||
memcpy(new_out+new_out_len, "\r\n", 2);
|
||||
new_out_len +=2;
|
||||
FREE(&pre_out);
|
||||
match++;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(new_out+new_out_len, sub_token, strlen(sub_token));
|
||||
new_out_len += strlen(sub_token);
|
||||
memcpy(new_out+new_out_len, "\r\n", 2);
|
||||
new_out_len +=2;
|
||||
}
|
||||
}
|
||||
|
||||
if(new_out)
|
||||
if(match == 0 && new_out != NULL)
|
||||
{
|
||||
free(new_out);
|
||||
new_out=NULL;
|
||||
*out = new_out;
|
||||
output_size = 0;
|
||||
}
|
||||
else if(new_out)
|
||||
{
|
||||
*out = new_out;
|
||||
output_size = strlen(new_out);
|
||||
|
||||
@@ -657,7 +657,15 @@ static int http_lua_rewrite_header(struct elua_vm *vm)
|
||||
return 0;
|
||||
}
|
||||
|
||||
tfe_http_nonstd_field_write(tsg_ctx->replacing, field_name, field_value);
|
||||
enum tfe_http_std_field field_id=http_field_name_to_std_field(field_name, strlen(field_name));
|
||||
if(field_id == TFE_HTTP_UNKNOWN_FIELD)
|
||||
{
|
||||
tfe_http_nonstd_field_write(tsg_ctx->replacing, field_name, field_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
tfe_http_std_field_write(tsg_ctx->replacing, field_id, field_value);
|
||||
}
|
||||
tsg_ctx->execut_lua_sucess=1;
|
||||
tsg_ctx->rewrite_header=1;
|
||||
|
||||
|
||||
@@ -145,6 +145,7 @@ static int get_ip_client_geolocation(struct tfe_cmsg * cmsg, cJSON *per_hit_obj)
|
||||
|
||||
for(i=TFE_CMSG_SRC_REGION_STR; i <= TFE_CMSG_DST_SUBDIVISION_STR; i+=2)
|
||||
{
|
||||
memset(opt_val, 0, sizeof(opt_val));
|
||||
int ret = tfe_cmsg_get_value(cmsg, (enum tfe_cmsg_tlv_type)i, (unsigned char *)opt_val, sizeof(opt_val), &opt_out_size);
|
||||
if (ret == 0)
|
||||
{
|
||||
@@ -163,6 +164,7 @@ static int get_ip_server_geolocation(struct tfe_cmsg * cmsg, cJSON *per_hit_obj)
|
||||
|
||||
for(i=TFE_CMSG_DST_REGION_STR; i <= TFE_CMSG_DST_SUBDIVISION_STR; i+=2)
|
||||
{
|
||||
memset(opt_val, 0, sizeof(opt_val));
|
||||
int ret = tfe_cmsg_get_value(cmsg, (enum tfe_cmsg_tlv_type)i, (unsigned char *)opt_val, sizeof(opt_val), &opt_out_size);
|
||||
if (ret == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user