summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorluwenpeng <[email protected]>2021-02-23 09:33:27 +0800
committer卢文朋 <[email protected]>2021-02-23 14:51:15 +0800
commit62dde9ea6e638900e7616dd90e688dd270df7416 (patch)
tree086c736488b618db9a6b7c30b1570e8fa37ca2ca /plugin
parent24401b07712f4f27b9326fef8c41b9d43fd73f20 (diff)
TSG-4427 将 DoH 的重定向纳入 Proxy Redredict 计数,DoH_hijack 计数保留v4.3.30-202103release-4.3develop-4.3
Diffstat (limited to 'plugin')
-rw-r--r--plugin/business/doh/src/doh.cpp5
-rw-r--r--plugin/business/pangu-http/src/pangu_http.cpp7
2 files changed, 10 insertions, 2 deletions
diff --git a/plugin/business/doh/src/doh.cpp b/plugin/business/doh/src/doh.cpp
index aa0af29..805433d 100644
--- a/plugin/business/doh/src/doh.cpp
+++ b/plugin/business/doh/src/doh.cpp
@@ -1,6 +1,8 @@
#include "logger.h"
#include <tfe_scan.h>
+extern void increase_redirect_policy_hit_num(void);
+
#define DOH_CTX_MAGIC_NUM 20200601
#define REQ_METHOD_IS_GET(method) ((method == TFE_HTTP_METHOD_GET) ? 1 : 0)
@@ -548,8 +550,9 @@ static void doh_process_req(const struct tfe_stream *stream, const struct tfe_ht
ctx->manipulate = 1;
ATOMIC_INC(&(g_doh_conf->stat_val[STAT_ACTION_HIJACK]));
+ increase_redirect_policy_hit_num();
- snprintf(cont_len_str, sizeof(cont_len_str), "%d", rsp_len);
+ snprintf(cont_len_str, sizeof(cont_len_str), "%d", rsp_len);
response = tfe_http_session_response_create(to_write, 200);
tfe_http_std_field_write(response, TFE_HTTP_CONT_LENGTH, cont_len_str);
if (ctx->type == DOH_TYPE_MESSAGE)
diff --git a/plugin/business/pangu-http/src/pangu_http.cpp b/plugin/business/pangu-http/src/pangu_http.cpp
index 0a373da..b3f34b1 100644
--- a/plugin/business/pangu-http/src/pangu_http.cpp
+++ b/plugin/business/pangu-http/src/pangu_http.cpp
@@ -196,6 +196,11 @@ static void pangu_http_stat_init(struct pangu_rt * pangu_runtime)
return;
}
+void increase_redirect_policy_hit_num(void)
+{
+ ATOMIC_INC(&(g_pangu_rt->stat_val[STAT_ACTION_REDIRECT]));
+}
+
void trusted_CA_update_start_cb(int update_type, void* u_para)
{
if(update_type==MAAT_RULE_UPDATE_TYPE_FULL)
@@ -1558,7 +1563,7 @@ static void http_redirect(const struct tfe_http_session * session, enum tfe_http
ATOMIC_INC(&(g_pangu_rt->stat_val[STAT_ACTION_REDIRECT]));
- response = tfe_http_session_response_create(to_write, resp_code);
+ response = tfe_http_session_response_create(to_write, resp_code);
tfe_http_std_field_write(response, TFE_HTTP_LOCATION, rd_url);
tfe_http_std_field_write(response, TFE_HTTP_CONT_LENGTH, "0");
tfe_http_half_append_body(response, NULL, 0, 0);