初步调通HTTP重定向业务
* 增加HTTP Status标准化定义及辅助函数; * 增加HTTP解析层发送应答的功能 * 修正了Pangu HTTP实现导致段错误的一系列问题。
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user