summaryrefslogtreecommitdiff
path: root/common/src/tfe_http.cpp
diff options
context:
space:
mode:
authorLu Qiuwen <[email protected]>2018-09-25 10:17:50 +0800
committerLu Qiuwen <[email protected]>2018-09-25 10:17:50 +0800
commitc2f0bde211fc820554bb6b1d635c0920d8677e81 (patch)
tree1d83296cc1328223a7359875622e603cc06619d7 /common/src/tfe_http.cpp
parent0776cb3ec8c7173a20cf0f31a9a3ff56d48e8457 (diff)
初步调通HTTP重定向业务
* 增加HTTP Status标准化定义及辅助函数; * 增加HTTP解析层发送应答的功能 * 修正了Pangu HTTP实现导致段错误的一系列问题。
Diffstat (limited to 'common/src/tfe_http.cpp')
-rw-r--r--common/src/tfe_http.cpp34
1 files changed, 29 insertions, 5 deletions
diff --git a/common/src/tfe_http.cpp b/common/src/tfe_http.cpp
index 022f09b..45d8803 100644
--- a/common/src/tfe_http.cpp
+++ b/common/src/tfe_http.cpp
@@ -43,18 +43,34 @@ static const char * __str_std_header_field_map[] =
[TFE_HTTP_ACCEPT_ENCODING] = "Accept-Encoding"
};
-static const char * __str_std_method_map[] =
+static const char * __str_std_method_map[1024] = {};
+void __str_std_method_map_init() __attribute__((constructor, used));
+void __str_std_method_map_init()
{
-#define XX(num, name, string) [TFE_HTTP_##name] = #string,
- HTTP_METHOD_MAP(XX)
+#define XX(num, name, string) __str_std_method_map[TFE_HTTP_METHOD_##name] = #string;
+ __HTTP_METHOD_MAP(XX)
#undef XX
-};
+}
+
+static const char * __str_std_status_map[1024] = {};
+void __str_std_status_map_init() __attribute__((constructor, used));
+void __str_std_status_map_init()
+{
+#define XX(num, name, string) __str_std_status_map[TFE_HTTP_STATUS_##name] = #string;
+ __HTTP_STATUS_MAP(XX)
+#undef XX
+}
const char * http_std_method_to_string(enum tfe_http_std_method method)
{
return __str_std_method_map[method];
}
+const char * http_std_status_to_string(enum tfe_http_std_status status)
+{
+ return __str_std_status_map[status];
+}
+
struct http_field_name * http_field_name_duplicate(const struct http_field_name * orig)
{
struct http_field_name * __duplicated = ALLOC(struct http_field_name, 1);
@@ -188,12 +204,20 @@ void http_frame_raise_event(struct http_frame_session_ctx * ht_frame,
struct tfe_plugin * plugin_info_iter;
TFE_PLUGIN_FOREACH(plugin_info_iter, &__for_each_iterator)
{
- if (plugin_info_iter->on_session_data == NULL) continue;
+ if (plugin_info_iter->on_session_data == NULL)
+ {
+ continue;
+ }
/* Calling ctx, in callback can fetch by calling frame_plugin_status_get_XXX */
ht_frame->calling_plugin = plugin_info_iter;
ht_frame->calling_plugin_status = &ht_frame->plugin_status[__plugin_id];
+ if (ht_frame->calling_plugin_status->detached)
+ {
+ continue;
+ }
+
void ** calling_pme = &ht_frame->calling_plugin_status->pme;
plugin_info_iter->on_session_data(stream, ht_session, event, data, datalen, thread_id, calling_pme);
}