summaryrefslogtreecommitdiff
path: root/plugin/protocol/http2/src/http2_stream.cpp
diff options
context:
space:
mode:
authorfengweihao <[email protected]>2019-07-31 13:45:08 +0800
committerfengweihao <[email protected]>2019-07-31 13:45:08 +0800
commitaa88471f2564da19e2f6a1b8e01fc5393316be99 (patch)
tree1becbfb08a3207439e4286b87d9944a6c90e3c6d /plugin/protocol/http2/src/http2_stream.cpp
parent92e8759bada6e3e65f0aa8a91470426b35483ee1 (diff)
修复残留数据,造成select_padding函数段错误
Diffstat (limited to 'plugin/protocol/http2/src/http2_stream.cpp')
-rw-r--r--plugin/protocol/http2/src/http2_stream.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/plugin/protocol/http2/src/http2_stream.cpp b/plugin/protocol/http2/src/http2_stream.cpp
index 806037f..a45d2fb 100644
--- a/plugin/protocol/http2/src/http2_stream.cpp
+++ b/plugin/protocol/http2/src/http2_stream.cpp
@@ -1056,19 +1056,17 @@ nghttp2_submit_frame_ping(struct tfe_h2_stream *connection,const nghttp2_frame *
nghttp2_session *ngh2_session = tfe_h2_stream_get_nghttp2_session(connection, dir);
- rv = nghttp2_submit_ping(ngh2_session, ping->hd.flags,
- ping->opaque_data);
- if (rv != 0){
+ rv = nghttp2_submit_ping(ngh2_session, ping->hd.flags, ping->opaque_data);
+ if (rv != 0)
+ {
stream_action = ACTION_FORWARD_DATA;
- TFE_LOG_ERROR(logger()->handle, "dir(%d), Submit ping error: %s\n",
- dir, nghttp2_strerror(rv));
+ TFE_LOG_ERROR(logger()->handle, "dir(%d), Submit ping error: %s\n", dir, nghttp2_strerror(rv));
return 0;
}
xret = nghttp2_session_send(ngh2_session);
if (xret != 0) {
stream_action = ACTION_FORWARD_DATA;
- TFE_LOG_ERROR(logger()->handle, "dir(%d), Fatal send error: %s\n",
- dir, nghttp2_strerror(xret));
+ TFE_LOG_ERROR(logger()->handle, "dir(%d), Fatal send error: %s\n", dir, nghttp2_strerror(xret));
}
connection->stream_action = stream_action;
return 0;
@@ -1842,7 +1840,8 @@ 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);
+ fill_req_spec_from_handle(h2_session->req);
+ h2_stream_info->as_client->last_sent_stream_id = MIN(h2_stream_info->as_client->last_sent_stream_id, stream_id) - 1;
req->event_cb(req, EV_HTTP_REQ_HDR, NULL, 0, req->event_cb_user);
@@ -2260,15 +2259,15 @@ static ssize_t nghttp2_client_select_padding_callback(nghttp2_session *session,
size_t max_payloadlen, void *user_data)
{
struct tfe_h2_half_private *resp = NULL;
- struct tfe_h2_session *h2_session = NULL;
-
- h2_session = (struct tfe_h2_session *)nghttp2_session_get_stream_user_data(session, frame->hd.stream_id);
- if (!h2_session)
- return frame->hd.length;
+ struct tfe_h2_stream *h2_stream_info = (struct tfe_h2_stream *)user_data;
+
+ struct tfe_h2_session *h2_session = TAILQ_LIST_FIND(h2_stream_info, frame->hd.stream_id);
+ if (h2_session == NULL) return frame->hd.length;
+
resp = h2_session->resp;
- if (!resp)
+ if (resp == NULL)
return frame->hd.length;
-
+
return (ssize_t)MIN(max_payloadlen, frame->hd.length + (resp->h2_payload.padlen));
}