TSG-10595 Proxy-Deny中Subscriber ID替换修复,TSG-10601 上传文件窗口限制问题修复
This commit is contained in:
@@ -63,45 +63,6 @@ struct user_event_dispatch
|
||||
unsigned int thread_id;
|
||||
};
|
||||
|
||||
static uint32_t hash(int32_t key, uint32_t mod)
|
||||
{
|
||||
uint32_t h = (uint32_t)key;
|
||||
h ^= (h >> 20) ^ (h >> 12);
|
||||
h ^= (h >> 7) ^ (h >> 4);
|
||||
return h & (mod - 1);
|
||||
}
|
||||
|
||||
nghttp2_map_entry *http2_map_find(nghttp2_map *map, key_type key)
|
||||
{
|
||||
uint32_t h;
|
||||
nghttp2_map_entry *entry;
|
||||
|
||||
h = hash(key, map->tablelen);
|
||||
for (entry = map->table[h]; entry; entry = entry->next)
|
||||
{
|
||||
if (entry->key == key)
|
||||
{
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
nghttp2_stream *http2_get_stream_by_stream_id(nghttp2_session *session, int32_t stream_id)
|
||||
{
|
||||
nghttp2_stream *stream;
|
||||
|
||||
stream = (nghttp2_stream *)http2_map_find(&session->streams, stream_id);
|
||||
|
||||
if (stream == NULL || (stream->flags & NGHTTP2_STREAM_FLAG_CLOSED) || stream->state == NGHTTP2_STREAM_IDLE)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
/*up stream */
|
||||
static struct tfe_h2_session *TAILQ_LIST_FIND(struct tfe_h2_stream *h2_stream_info, int32_t stream_id)
|
||||
{
|
||||
@@ -726,7 +687,7 @@ static ssize_t upstream_read_callback(nghttp2_session *session, int32_t stream_i
|
||||
|
||||
static int http_session_update_window_size(struct tfe_h2_stream *h2_stream_info, struct tfe_h2_session *h2_session, int32_t buffer_length)
|
||||
{
|
||||
nghttp2_stream *stream = http2_get_stream_by_stream_id(h2_stream_info->http2_server_handle, h2_session->ngh2_stream_id);
|
||||
nghttp2_stream *stream = nghttp2_session_find_stream(h2_stream_info->http2_server_handle, h2_session->ngh2_stream_id);
|
||||
if(stream == NULL)
|
||||
{
|
||||
return 0;
|
||||
@@ -911,8 +872,13 @@ static enum tfe_stream_action http2_submit_data_by_h2_half(struct tfe_h2_stream
|
||||
upstream_data_provider.source.ptr = (void *)body;
|
||||
upstream_data_provider.read_callback = upstream_read_callback;
|
||||
|
||||
rv = nghttp2_submit_data(ngh2_session, body->flags,
|
||||
h2_session->ngh2_stream_id, &upstream_data_provider);
|
||||
int remote_window_size = nghttp2_session_get_stream_remote_window_size(ngh2_session, h2_session->ngh2_stream_id);
|
||||
if(remote_window_size == 0)
|
||||
{
|
||||
stream_action = ACTION_DROP_DATA;
|
||||
return stream_action;
|
||||
}
|
||||
rv = nghttp2_submit_data(ngh2_session, body->flags, h2_session->ngh2_stream_id, &upstream_data_provider);
|
||||
if (rv != 0)
|
||||
{
|
||||
stream_action = ACTION_FORWARD_DATA;
|
||||
@@ -1139,15 +1105,33 @@ finish:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If the data sent by the client is deferred, After receive the WINDOW_UPDATE frame, it resumes and needs to resend the data that you deferred last time**/
|
||||
static int nghttp2_send_resumes_data(struct tfe_h2_stream *connection, int32_t stream_id, enum tfe_conn_dir dir)
|
||||
{
|
||||
int xret = -1;
|
||||
nghttp2_session *session = tfe_h2_stream_get_http2_peer_session(connection, dir);
|
||||
nghttp2_stream *stream = nghttp2_session_find_stream(session, stream_id);
|
||||
if(stream->item)
|
||||
{
|
||||
xret = nghttp2_session_send(session);
|
||||
if (xret != 0)
|
||||
{
|
||||
TFE_LOG_ERROR(logger()->handle, "dir(%d), Fatal send error: %s\n", dir, nghttp2_strerror(xret));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int http2_submit_frame_window_update(struct tfe_h2_stream *connection,const nghttp2_frame *frame, enum tfe_conn_dir dir)
|
||||
{
|
||||
int xret = -1;
|
||||
enum tfe_stream_action stream_action = ACTION_DROP_DATA;
|
||||
|
||||
const nghttp2_window_update *window_update = &(frame->window_update);
|
||||
|
||||
nghttp2_session *ngh2_session = tfe_h2_stream_get_http2_session(connection, dir);
|
||||
|
||||
nghttp2_send_resumes_data(connection, window_update->hd.stream_id, dir);
|
||||
|
||||
int rv = nghttp2_submit_window_update(ngh2_session, window_update->hd.flags,window_update->hd.stream_id,
|
||||
window_update->window_size_increment);
|
||||
if (rv != 0) {
|
||||
@@ -1159,8 +1143,7 @@ static int http2_submit_frame_window_update(struct tfe_h2_stream *connection,con
|
||||
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;
|
||||
@@ -1270,7 +1253,8 @@ static int http2_submit_frame_data(struct tfe_h2_stream *h2_stream_info,const ng
|
||||
if (dir == CONN_DIR_UPSTREAM)
|
||||
h2_half->h2_payload.padlen = frame->data.padlen;
|
||||
|
||||
if (h2_half->body_state != H2_READ_STATE_COMPLETE){
|
||||
if (h2_half->body_state != H2_READ_STATE_COMPLETE)
|
||||
{
|
||||
http2_submit_complete_data(h2_stream_info, h2_session, dir);
|
||||
}
|
||||
}
|
||||
@@ -1765,8 +1749,7 @@ static enum tfe_stream_action http2_client_frame_submit_header(struct tfe_h2_str
|
||||
headers->nvlen, h2_session);
|
||||
|
||||
if (stream_id < 0){
|
||||
TFE_LOG_ERROR(logger()->handle, "Could not submit request: %s",
|
||||
nghttp2_strerror(stream_id));
|
||||
TFE_LOG_ERROR(logger()->handle, "Could not submit request: %s", nghttp2_strerror(stream_id));
|
||||
stream_action = ACTION_FORWARD_DATA;
|
||||
goto finish;
|
||||
}
|
||||
@@ -1806,8 +1789,7 @@ static int http2_client_submit_header(struct tfe_h2_stream *h2_stream_info, int3
|
||||
xret = nghttp2_session_send(h2_stream_info->http2_client_handle);
|
||||
if (xret != 0) {
|
||||
stream_action = ACTION_FORWARD_DATA;
|
||||
TFE_LOG_ERROR(logger()->handle, "Fatal downstream send error: %s\n",
|
||||
nghttp2_strerror(xret));
|
||||
TFE_LOG_ERROR(logger()->handle, "Fatal downstream send error: %s\n", nghttp2_strerror(xret));
|
||||
}
|
||||
}
|
||||
if (stream_action == ACTION_USER_DATA)
|
||||
@@ -2403,8 +2385,7 @@ static int http2_server_on_data_chunk_recv(nghttp2_session *session, uint8_t fla
|
||||
|
||||
struct tfe_h2_session *h2_session = (struct tfe_h2_session *)nghttp2_session_get_stream_user_data(session, stream_id);
|
||||
if (!h2_session){
|
||||
TFE_LOG_ERROR(logger()->handle, "On data callback can't get downstream information, id = %d",
|
||||
stream_id);
|
||||
TFE_LOG_ERROR(logger()->handle, "On data callback can't get downstream information, id = %d", stream_id);
|
||||
goto finish;
|
||||
}
|
||||
req = h2_session->req;
|
||||
|
||||
Reference in New Issue
Block a user