From b8a2bf26753de1faf026960630ca33454886f4ed Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 30 Jul 2014 22:37:59 +0900 Subject: [PATCH] Remove END_SEGMENT flag --- lib/includes/nghttp2/nghttp2.h | 7 +------ lib/nghttp2_frame.c | 7 +++---- lib/nghttp2_session.c | 7 +------ lib/nghttp2_submit.c | 7 ++----- src/app_helper.cc | 12 ------------ tests/nghttp2_session_test.c | 6 ++---- 6 files changed, 9 insertions(+), 37 deletions(-) diff --git a/lib/includes/nghttp2/nghttp2.h b/lib/includes/nghttp2/nghttp2.h index e5f9569a..a3a53f85 100644 --- a/lib/includes/nghttp2/nghttp2.h +++ b/lib/includes/nghttp2/nghttp2.h @@ -476,10 +476,6 @@ typedef enum { * The ACK flag. */ NGHTTP2_FLAG_ACK = 0x01, - /** - * The END_SEGMENT flag. - */ - NGHTTP2_FLAG_END_SEGMENT = 0x02, /** * The PADDED flag. */ @@ -2382,8 +2378,7 @@ int32_t nghttp2_submit_headers(nghttp2_session *session, uint8_t flags, * Submits one or more DATA frames to the stream |stream_id|. The * data to be sent are provided by |data_prd|. If |flags| contains * :enum:`NGHTTP2_FLAG_END_STREAM`, the last DATA frame has END_STREAM - * flag set. If |flags| contains :enum:`NGHTTP2_FLAG_END_SEGMENT`, - * the last DATA frame has END_SEGMENT flag set. + * flag set. * * This function does not take ownership of the |data_prd|. The * function copies the members of the |data_prd|. diff --git a/lib/nghttp2_frame.c b/lib/nghttp2_frame.c index fb2f961a..228284f7 100644 --- a/lib/nghttp2_frame.c +++ b/lib/nghttp2_frame.c @@ -231,11 +231,10 @@ void nghttp2_frame_data_init(nghttp2_data *frame, nghttp2_private_data *pdata) { frame->hd = pdata->hd; frame->padlen = pdata->padlen; - /* flags may have NGHTTP2_FLAG_END_STREAM or - NGHTTP2_FLAG_END_SEGMENT even if the sent chunk is not the end of - the stream */ + /* flags may have NGHTTP2_FLAG_END_STREAM even if the sent chunk is + not the end of the stream */ if(!pdata->eof) { - frame->hd.flags &= ~(NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_SEGMENT); + frame->hd.flags &= ~NGHTTP2_FLAG_END_STREAM; } } diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index d6e1d1d4..cd7c1df6 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -4325,7 +4325,6 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, DEBUGF(fprintf(stderr, "recv: DATA\n")); iframe->frame.hd.flags &= (NGHTTP2_FLAG_END_STREAM | - NGHTTP2_FLAG_END_SEGMENT | NGHTTP2_FLAG_PADDED); /* Check stream is open. If it is not open or closing, ignore payload. */ @@ -4369,7 +4368,6 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, DEBUGF(fprintf(stderr, "recv: HEADERS\n")); iframe->frame.hd.flags &= (NGHTTP2_FLAG_END_STREAM | - NGHTTP2_FLAG_END_SEGMENT | NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_PADDED | NGHTTP2_FLAG_PRIORITY); @@ -5576,7 +5574,7 @@ int nghttp2_session_pack_data(nghttp2_session *session, /* Clear flags, because this may contain previous flags of previous DATA */ - frame->hd.flags &= (NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_SEGMENT); + frame->hd.flags &= NGHTTP2_FLAG_END_STREAM; flags = NGHTTP2_FLAG_NONE; if(data_flags & NGHTTP2_DATA_FLAG_EOF) { @@ -5584,9 +5582,6 @@ int nghttp2_session_pack_data(nghttp2_session *session, if(frame->hd.flags & NGHTTP2_FLAG_END_STREAM) { flags |= NGHTTP2_FLAG_END_STREAM; } - if(frame->hd.flags & NGHTTP2_FLAG_END_SEGMENT) { - flags |= NGHTTP2_FLAG_END_SEGMENT; - } } /* The primary reason of data_frame is pass to the user callback */ diff --git a/lib/nghttp2_submit.c b/lib/nghttp2_submit.c index c9e65f2c..eea748b9 100644 --- a/lib/nghttp2_submit.c +++ b/lib/nghttp2_submit.c @@ -81,9 +81,7 @@ static int32_t submit_headers_shared } flags_copy = - (flags & (NGHTTP2_FLAG_END_STREAM | - NGHTTP2_FLAG_END_SEGMENT | - NGHTTP2_FLAG_PRIORITY)) | + (flags & (NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_PRIORITY)) | NGHTTP2_FLAG_END_HEADERS; if(stream_id == -1) { @@ -538,8 +536,7 @@ int nghttp2_submit_data(nghttp2_session *session, uint8_t flags, { int rv; nghttp2_private_data *data_frame; - uint8_t nflags = flags & (NGHTTP2_FLAG_END_STREAM | - NGHTTP2_FLAG_END_SEGMENT); + uint8_t nflags = flags & NGHTTP2_FLAG_END_STREAM; if(stream_id == 0) { return NGHTTP2_ERR_INVALID_ARGUMENT; diff --git a/src/app_helper.cc b/src/app_helper.cc index 756fa519..b82f8ec3 100644 --- a/src/app_helper.cc +++ b/src/app_helper.cc @@ -221,12 +221,6 @@ void print_flags(const nghttp2_frame_hd& hd) if(hd.flags & NGHTTP2_FLAG_END_STREAM) { s += "END_STREAM"; } - if(hd.flags & NGHTTP2_FLAG_END_SEGMENT) { - if(!s.empty()) { - s += " | "; - } - s += "END_SEGMENT"; - } if(hd.flags & NGHTTP2_FLAG_PADDED) { if(!s.empty()) { s += " | "; @@ -238,12 +232,6 @@ void print_flags(const nghttp2_frame_hd& hd) if(hd.flags & NGHTTP2_FLAG_END_STREAM) { s += "END_STREAM"; } - if(hd.flags & NGHTTP2_FLAG_END_SEGMENT) { - if(!s.empty()) { - s += " | "; - } - s += "END_SEGMENT"; - } if(hd.flags & NGHTTP2_FLAG_END_HEADERS) { if(!s.empty()) { s += " | "; diff --git a/tests/nghttp2_session_test.c b/tests/nghttp2_session_test.c index bf89121b..567cd2ee 100644 --- a/tests/nghttp2_session_test.c +++ b/tests/nghttp2_session_test.c @@ -2989,8 +2989,7 @@ void test_nghttp2_submit_data(void) &pri_spec_default, NGHTTP2_STREAM_OPENING, NULL); CU_ASSERT(0 == nghttp2_submit_data(session, - NGHTTP2_FLAG_END_STREAM | - NGHTTP2_FLAG_END_SEGMENT, 1, &data_prd)); + NGHTTP2_FLAG_END_STREAM, 1, &data_prd)); ud.block_count = 0; CU_ASSERT(0 == nghttp2_session_send(session)); @@ -3001,8 +3000,7 @@ void test_nghttp2_submit_data(void) CU_ASSERT(NGHTTP2_FLAG_NONE == hd.flags); /* frame->hd.flags has these flags */ - CU_ASSERT((NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_SEGMENT) == - data_frame->hd.flags); + CU_ASSERT(NGHTTP2_FLAG_END_STREAM == data_frame->hd.flags); nghttp2_session_del(session); }