修复twitter页面无法显示问题,原因为注册END_STREAM时传参错误,导致获取取half值时方向错误
http2注册请求头时,不在区分post/get
This commit is contained in:
@@ -157,7 +157,7 @@ tfe_h2_header_modify_field(struct tfe_h2_header *header, nghttp2_nv *hdrs, const
|
||||
{
|
||||
hdrs[nvlen].value = h2_field->nv.value;
|
||||
hdrs[nvlen].valuelen = h2_field->nv.valuelen;
|
||||
}
|
||||
}
|
||||
hdrs[nvlen].flags = h2_field->nv.flags;
|
||||
nvlen++;
|
||||
}
|
||||
@@ -864,9 +864,9 @@ nghttp2_submit_data_by_h2_half(struct tfe_h2_stream *connection,
|
||||
struct tfe_h2_session *h2_session,
|
||||
enum tfe_conn_dir dir)
|
||||
{
|
||||
enum tfe_stream_action stream_action = ACTION_DROP_DATA;
|
||||
|
||||
struct tfe_h2_half_private *h2_half = (dir == CONN_DIR_UPSTREAM) ? h2_session->resp : h2_session->req;
|
||||
enum tfe_stream_action stream_action = ACTION_DROP_DATA;
|
||||
struct tfe_h2_half_private *h2_half = tfe_h2_stream_get_half(h2_session, dir);
|
||||
|
||||
nghttp2_session *ngh2_session = tfe_h2_stream_get_nghttp2_session(connection, dir);
|
||||
|
||||
if (h2_session->plugin_built_resp)
|
||||
@@ -1239,7 +1239,7 @@ nghttp2_submit_complete_data(struct tfe_h2_stream *h2_stream_info,
|
||||
h2_half->body_state = H2_READ_STATE_COMPLETE;
|
||||
h2_half->message_state = H2_READ_STATE_COMPLETE;
|
||||
|
||||
stream_action = nghttp2_submit_data_by_h2_half(h2_stream_info, h2_session, CONN_DIR_UPSTREAM);
|
||||
stream_action = nghttp2_submit_data_by_h2_half(h2_stream_info, h2_session, dir);
|
||||
if (stream_action == ACTION_DROP_DATA){
|
||||
xret = nghttp2_session_send(ngh2_session);
|
||||
if (xret != 0) {
|
||||
@@ -1650,7 +1650,7 @@ finish:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fill_req_spec_from_handle(struct tfe_h2_half_private *half_private)
|
||||
static void fill_req_spec_from_handle(struct tfe_h2_half_private *half_private)
|
||||
{
|
||||
int urllen = 0;
|
||||
struct tfe_h2_field *h2_field = NULL, *peer_h2_field = NULL;
|
||||
@@ -1677,10 +1677,8 @@ static int fill_req_spec_from_handle(struct tfe_h2_half_private *half_private)
|
||||
if(urltmp){
|
||||
sprintf(urltmp, "%s%s", (char *)req_spec->host, (char *)req_spec->uri);
|
||||
req_spec->url = urltmp;
|
||||
if (strcasestr(urltmp, "twitter"))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TFE_CACHE
|
||||
@@ -1728,7 +1726,7 @@ finish:
|
||||
|
||||
static enum tfe_stream_action
|
||||
nghttp2_client_frame_submit_header(struct tfe_h2_stream *h2_stream_info,
|
||||
struct tfe_h2_session *h2_session, int twitter)
|
||||
struct tfe_h2_session *h2_session)
|
||||
{
|
||||
int32_t stream_id = -1;
|
||||
struct tfe_h2_header *headers = NULL;
|
||||
@@ -1757,24 +1755,19 @@ nghttp2_client_frame_submit_header(struct tfe_h2_stream *h2_stream_info,
|
||||
return ACTION_FORWARD_DATA;
|
||||
}
|
||||
|
||||
nghttp2_nv hdrs[headers->nvlen];
|
||||
|
||||
method = nghttp2_get_method(h2_session->req);
|
||||
if ((method == (enum tfe_http_std_method)NGHTTP2_METHOD_POST ||
|
||||
method == (enum tfe_http_std_method)NGHTTP2_METHOD_PUT) && twitter != 1){
|
||||
if (h2_session->plugin_built_req)
|
||||
if (method == (enum tfe_http_std_method)NGHTTP2_METHOD_POST || method == (enum tfe_http_std_method)NGHTTP2_METHOD_PUT)
|
||||
{
|
||||
if (h2_session->plugin_built_req != NULL)
|
||||
{
|
||||
stream_action = (enum tfe_stream_action)ACTION_USER_DATA;
|
||||
return stream_action;
|
||||
}
|
||||
stream_id = nghttp2_submit_headers(h2_stream_info->as_client, headers->flag,
|
||||
-1, NULL, tfe_h2_header_modify_field(headers, hdrs, ":path", req->url_storage),
|
||||
headers->nvlen, h2_session);
|
||||
}else{
|
||||
stream_id = nghttp2_submit_request(h2_stream_info->as_client, NULL,
|
||||
tfe_h2_header_modify_field(headers, hdrs, ":path", req->url_storage),
|
||||
headers->nvlen, NULL, h2_session);
|
||||
}
|
||||
}
|
||||
nghttp2_nv hdrs[headers->nvlen];
|
||||
stream_id = nghttp2_submit_headers(h2_stream_info->as_client, headers->flag,
|
||||
-1, NULL, tfe_h2_header_modify_field(headers, hdrs, ":path", req->url_storage),
|
||||
headers->nvlen, h2_session);
|
||||
if (stream_id < 0){
|
||||
TFE_LOG_ERROR(logger()->handle, "Could not submit request: %s",
|
||||
nghttp2_strerror(stream_id));
|
||||
@@ -1790,7 +1783,7 @@ finish:
|
||||
static int
|
||||
nghttp2_client_submit_header(struct tfe_h2_stream *h2_stream_info, int32_t stream_id)
|
||||
{
|
||||
int xret = -1, twitter = 1;
|
||||
int xret = -1;
|
||||
struct tfe_h2_half_private *req = NULL;
|
||||
struct tfe_h2_session *h2_session = NULL;
|
||||
|
||||
@@ -1805,12 +1798,12 @@ nghttp2_client_submit_header(struct tfe_h2_stream *h2_stream_info, int32_t strea
|
||||
assert(h2_session->ngh2_stream_id == stream_id);
|
||||
|
||||
req = h2_session->req;
|
||||
twitter = fill_req_spec_from_handle(h2_session->req);
|
||||
fill_req_spec_from_handle(h2_session->req);
|
||||
|
||||
req->event_cb(req, EV_HTTP_REQ_HDR, NULL, 0, req->event_cb_user);
|
||||
|
||||
nghttp2_write_log(h2_session, h2_stream_info->tf_stream->str_stream_info, CONN_DIR_DOWNSTREAM);
|
||||
stream_action = nghttp2_client_frame_submit_header(h2_stream_info, h2_session, twitter);
|
||||
stream_action = nghttp2_client_frame_submit_header(h2_stream_info, h2_session);
|
||||
if (stream_action == ACTION_DROP_DATA){
|
||||
xret = nghttp2_session_send(h2_stream_info->as_client);
|
||||
if (xret != 0) {
|
||||
|
||||
Reference in New Issue
Block a user