diff options
| author | fengweihao <[email protected]> | 2019-08-21 19:47:30 +0800 |
|---|---|---|
| committer | fengweihao <[email protected]> | 2019-08-21 19:47:30 +0800 |
| commit | 5f366986ba51ab1612c4e79f9729d4ed935782d5 (patch) | |
| tree | 12ad68f5ff712737f79bd4af5e2dbcc61f30c68f /plugin/business/pangu-http/src/pattern_replace.cpp | |
| parent | a02fe27f172b23178eab944524b3c574c630319e (diff) | |
修改insert读取位置方式
修改插入脚本位置判断
Diffstat (limited to 'plugin/business/pangu-http/src/pattern_replace.cpp')
| -rw-r--r-- | plugin/business/pangu-http/src/pattern_replace.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/plugin/business/pangu-http/src/pattern_replace.cpp b/plugin/business/pangu-http/src/pattern_replace.cpp index 9e54bae..87d0de0 100644 --- a/plugin/business/pangu-http/src/pattern_replace.cpp +++ b/plugin/business/pangu-http/src/pattern_replace.cpp @@ -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>"); } |
