修复从服务端控制帧判断http2流字节数限制

This commit is contained in:
fengweihao
2019-07-02 22:20:12 +08:00
parent 348afbc00d
commit c3741ed8c0
2 changed files with 19 additions and 23 deletions

View File

@@ -1650,8 +1650,7 @@ finish:
return 0;
}
static void
fill_req_spec_from_handle(struct tfe_h2_half_private *half_private)
static int 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;
@@ -1678,9 +1677,10 @@ 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;
return 0;
}
#ifdef TFE_CACHE
@@ -1728,7 +1728,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)
struct tfe_h2_session *h2_session, int twitter)
{
int32_t stream_id = -1;
struct tfe_h2_header *headers = NULL;
@@ -1760,8 +1760,8 @@ nghttp2_client_frame_submit_header(struct tfe_h2_stream *h2_stream_info,
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){
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)
{
stream_action = (enum tfe_stream_action)ACTION_USER_DATA;
@@ -1790,7 +1790,7 @@ finish:
static int
nghttp2_client_submit_header(struct tfe_h2_stream *h2_stream_info, int32_t stream_id)
{
int xret = -1;
int xret = -1, twitter = 1;
struct tfe_h2_half_private *req = NULL;
struct tfe_h2_session *h2_session = NULL;
@@ -1805,12 +1805,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;
fill_req_spec_from_handle(h2_session->req);
twitter = 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);
stream_action = nghttp2_client_frame_submit_header(h2_stream_info, h2_session, twitter);
if (stream_action == ACTION_DROP_DATA){
xret = nghttp2_session_send(h2_stream_info->as_client);
if (xret != 0) {