修改insert读取位置方式
修改插入脚本位置判断
This commit is contained in:
@@ -212,17 +212,17 @@ size_t replace_string(const char * in, size_t in_sz, const struct replace_rule *
|
||||
not_enough_mem_retry:
|
||||
out_buffer = (PCRE2_UCHAR*)malloc(sizeof(PCRE2_UCHAR)*outbuff_size);
|
||||
outlen = outbuff_size;
|
||||
int rc = pcre2_substitute(re, subject, in_sz, 0,
|
||||
int rc = pcre2_substitute(re, subject, in_sz, 0,
|
||||
PCRE2_SUBSTITUTE_GLOBAL | PCRE2_SUBSTITUTE_EXTENDED | PCRE2_SUBSTITUTE_OVERFLOW_LENGTH,
|
||||
0, 0, //pcre2_match_data *match_data, pcre2_match_context
|
||||
replacement, strlen(zone->replace_with),
|
||||
0, 0, //pcre2_match_data *match_data, pcre2_match_context
|
||||
replacement, strlen(zone->replace_with),
|
||||
out_buffer, &outlen);
|
||||
if(outlen>outbuff_size)
|
||||
{
|
||||
outbuff_size=outlen;
|
||||
free(out_buffer);
|
||||
out_buffer=NULL;
|
||||
goto not_enough_mem_retry;
|
||||
goto not_enough_mem_retry;
|
||||
}
|
||||
if(rc<=0)
|
||||
{
|
||||
@@ -266,10 +266,10 @@ size_t execute_replace_rule(const char * in, size_t in_sz,
|
||||
}
|
||||
pre_out = new_out;
|
||||
pre_out_sz = output_size;
|
||||
|
||||
|
||||
interator = new_out;
|
||||
interator_sz = output_size;
|
||||
|
||||
|
||||
new_out=NULL;
|
||||
output_size=0;
|
||||
}
|
||||
@@ -308,7 +308,7 @@ static char *find_insert_position(char * in)
|
||||
insert_from=head_in;
|
||||
}
|
||||
return insert_from;
|
||||
}
|
||||
}
|
||||
|
||||
size_t insert_string(char * in, size_t in_sz, const char *insert_on, const char *script, const char *type, char** out)
|
||||
{
|
||||
@@ -328,7 +328,7 @@ size_t insert_string(char * in, size_t in_sz, const char *insert_on, const char
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (insert_on != NULL && 0==strcasecmp(insert_on, "after-page-load"))
|
||||
if (insert_on != NULL && 0==strcasecmp(insert_on, "after_page_load"))
|
||||
{
|
||||
insert_from=strstr(in, "</body>");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user