TSG-10225 修复应答码为103时,应答头重复问题
This commit is contained in:
@@ -41,14 +41,14 @@
|
||||
|
||||
static const struct value_string method_vals[] =
|
||||
{
|
||||
{NGHTTP2_METHOD_DELETE, "DELETE"},
|
||||
{NGHTTP2_METHOD_GET, "GET"},
|
||||
{NGHTTP2_METHOD_HEAD, "HEAD"},
|
||||
{NGHTTP2_METHOD_POST, "POST"},
|
||||
{NGHTTP2_METHOD_PUT, "PUT"},
|
||||
{NGHTTP2_METHOD_CONNECT, "CONNECT"},
|
||||
{NGHTTP2_METHOD_OPTIONS, "OPTIONS"},
|
||||
{NGHTTP2_METHOD_UNKNOWN, "unknown"},
|
||||
{HTTP_REQUEST_METHOD_DELETE, "DELETE"},
|
||||
{HTTP_REQUEST_METHOD_GET, "GET"},
|
||||
{HTTP_REQUEST_METHOD_HEAD, "HEAD"},
|
||||
{HTTP_REQUEST_METHOD_POST, "POST"},
|
||||
{HTTP_REQUEST_METHOD_PUT, "PUT"},
|
||||
{HTTP_REQUEST_METHOD_CONNECT, "CONNECT"},
|
||||
{HTTP_REQUEST_METHOD_OPTIONS, "OPTIONS"},
|
||||
{HTTP_REQUEST_METHOD_UNKNOWN, "unknown"},
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
@@ -130,7 +130,7 @@ static void tfe_h2_header_add_field(struct tfe_h2_header *h2_header, const struc
|
||||
peer_h2_field->nv.name = (uint8_t *)tfe_strdup((const char *)std_name);
|
||||
peer_h2_field->nv.namelen = strlen(std_name);
|
||||
}
|
||||
peer_h2_field->nv.value = (uint8_t *)tfe_strdup((const char *)value);;
|
||||
peer_h2_field->nv.value = (uint8_t *)tfe_strdup((const char *)value);
|
||||
peer_h2_field->nv.valuelen = strlen(value);
|
||||
h2_header->nvlen++;
|
||||
if (at_tail)
|
||||
@@ -212,7 +212,8 @@ static nghttp2_nv* tfe_h2_header_convert_nv(struct tfe_h2_header *header, nghttp
|
||||
int nvlen = 0;
|
||||
struct tfe_h2_field *h2_field = NULL, *peer_h2_field = NULL;
|
||||
|
||||
TAILQ_FOREACH_SAFE(h2_field, &header->h2_field_list, next, peer_h2_field){
|
||||
TAILQ_FOREACH_SAFE(h2_field, &header->h2_field_list, next, peer_h2_field)
|
||||
{
|
||||
hdrs[nvlen].name = h2_field->nv.name;
|
||||
hdrs[nvlen].namelen = h2_field->nv.namelen;
|
||||
hdrs[nvlen].value = h2_field->nv.value;
|
||||
@@ -1090,8 +1091,8 @@ void http2_disect_goaway(struct tfe_h2_stream *h2_stream_info)
|
||||
static int http2_submit_frame_goaway(struct tfe_h2_stream *connection, const nghttp2_frame *frame, enum tfe_conn_dir dir)
|
||||
{
|
||||
int xret = -1;
|
||||
const char *opaque_data = NULL;
|
||||
enum tfe_stream_action stream_action = ACTION_DROP_DATA;
|
||||
char *error = NULL; size_t eroro_len=0;
|
||||
|
||||
const nghttp2_goaway *goaway = &frame->goaway;
|
||||
nghttp2_session *ngh2_session = tfe_h2_stream_get_http2_session(connection, dir);
|
||||
@@ -1111,12 +1112,9 @@ static int http2_submit_frame_goaway(struct tfe_h2_stream *connection, const ngh
|
||||
dir, nghttp2_strerror(xret));
|
||||
}
|
||||
finish:
|
||||
eroro_len = goaway->opaque_data_len;
|
||||
error = ALLOC(char, eroro_len + 1);
|
||||
snprintf(error, eroro_len, "%s", goaway->opaque_data);
|
||||
opaque_data = ((const char *)goaway->opaque_data) != NULL ? (char *)goaway->opaque_data : "-";
|
||||
TFE_LOG_DEBUG(logger()->handle, "%s, %d, submit goaway, stream_id:%d, action:%d, errod_code:%d, data:%s", connection->tf_stream->str_stream_info,
|
||||
dir, goaway->last_stream_id, connection->stream_action, goaway->error_code, goaway->opaque_data);
|
||||
FREE(&error);
|
||||
dir, goaway->last_stream_id, connection->stream_action, goaway->error_code, opaque_data);
|
||||
connection->goaway = 1;
|
||||
connection->stream_action = stream_action;
|
||||
return 0;
|
||||
@@ -1513,6 +1511,26 @@ static enum tfe_stream_action http2_submit_built_response(struct tfe_h2_stream *
|
||||
return stream_action;
|
||||
}
|
||||
|
||||
static void h2_delete_resp_hdrs_filter(struct tfe_h2_header *headers, nghttp2_nv *hdrs)
|
||||
{
|
||||
if((headers->nvlen > 0) && strncasecmp((char *)hdrs[0].name, ":status", strlen((char *)hdrs[0].name)) == 0)
|
||||
{
|
||||
int resp_code = atoi((const char *)hdrs[0].value);
|
||||
switch(resp_code)
|
||||
{
|
||||
case HTTP_RESP_CODE_100:
|
||||
case HTTP_RESP_CODE_101:
|
||||
case HTTP_RESP_CODE_102:
|
||||
case HTTP_RESP_CODE_103:
|
||||
delete_nv_packet_data(headers);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static enum tfe_stream_action http2_server_frame_submit_header(struct tfe_h2_stream *h2_stream_info, struct tfe_h2_session *h2_session)
|
||||
{
|
||||
int32_t xret = 0;
|
||||
@@ -1548,6 +1566,8 @@ static enum tfe_stream_action http2_server_frame_submit_header(struct tfe_h2_str
|
||||
printf("Fatal headers error: %s\n", nghttp2_strerror(xret));
|
||||
}
|
||||
|
||||
h2_delete_resp_hdrs_filter(headers, hdrs);
|
||||
|
||||
return stream_action;
|
||||
}
|
||||
|
||||
@@ -1681,7 +1701,7 @@ static enum tfe_stream_action http2_client_frame_submit_header(struct tfe_h2_str
|
||||
int32_t stream_id = -1;
|
||||
struct tfe_h2_header *headers = NULL;
|
||||
struct tfe_h2_half_private *req = NULL;
|
||||
enum tfe_http_std_method method = (enum tfe_http_std_method)NGHTTP2_METHOD_UNKNOWN;
|
||||
enum tfe_http_std_method method = (enum tfe_http_std_method)HTTP_REQUEST_METHOD_UNKNOWN;
|
||||
enum tfe_stream_action stream_action = ACTION_FORWARD_DATA;
|
||||
|
||||
req = h2_session->plugin_built_req != NULL ? h2_session->plugin_built_req : h2_session->req;
|
||||
@@ -1704,7 +1724,7 @@ static enum tfe_stream_action http2_client_frame_submit_header(struct tfe_h2_str
|
||||
}
|
||||
|
||||
method = http2_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)HTTP_REQUEST_METHOD_POST || method == (enum tfe_http_std_method)HTTP_REQUEST_METHOD_PUT)
|
||||
{
|
||||
if (h2_session->plugin_built_req != NULL)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user