Remove END_PUSH_PROMISE in favor of END_HEADERS

This commit is contained in:
Tatsuhiro Tsujikawa 2014-02-21 21:23:51 +09:00
parent a21175398d
commit fc25143418
6 changed files with 15 additions and 19 deletions

View File

@ -394,10 +394,6 @@ typedef enum {
* The PRIORITY flag. * The PRIORITY flag.
*/ */
NGHTTP2_FLAG_PRIORITY = 0x8, NGHTTP2_FLAG_PRIORITY = 0x8,
/**
* The END_PUSH_PROMISE flag.
*/
NGHTTP2_FLAG_END_PUSH_PROMISE = 0x4,
/** /**
* The ACK flag. * The ACK flag.
*/ */
@ -2128,7 +2124,7 @@ int nghttp2_submit_settings(nghttp2_session *session, uint8_t flags,
* *
* Submits PUSH_PROMISE frame. The |flags| is currently ignored and * Submits PUSH_PROMISE frame. The |flags| is currently ignored and
* the resulting PUSH_PROMISE frame always has * the resulting PUSH_PROMISE frame always has
* :enum:`NGHTTP2_FLAG_END_PUSH_PROMISE` flag set due to the lack of * :enum:`NGHTTP2_FLAG_END_HEADERS` flag set due to the lack of
* header continuation support in the library. * header continuation support in the library.
* *
* The |stream_id| must be client initiated stream ID. * The |stream_id| must be client initiated stream ID.

View File

@ -197,7 +197,7 @@ int nghttp2_submit_push_promise(nghttp2_session *session, uint8_t flags,
free(frame); free(frame);
return rv; return rv;
} }
flags_copy = NGHTTP2_FLAG_END_PUSH_PROMISE; flags_copy = NGHTTP2_FLAG_END_HEADERS;
nghttp2_frame_push_promise_init(&frame->push_promise, flags_copy, nghttp2_frame_push_promise_init(&frame->push_promise, flags_copy,
stream_id, -1, nva_copy, nvlen); stream_id, -1, nva_copy, nvlen);
rv = nghttp2_session_add_frame(session, NGHTTP2_CAT_CTRL, frame, NULL); rv = nghttp2_session_add_frame(session, NGHTTP2_CAT_CTRL, frame, NULL);

View File

@ -514,7 +514,7 @@ int Http2Handler::submit_push_promise(Request *req,
http2::make_nv_ll(":scheme", "https"), http2::make_nv_ll(":scheme", "https"),
http2::make_nv_ls(":authority", (*itr).second) http2::make_nv_ls(":authority", (*itr).second)
}; };
return nghttp2_submit_push_promise(session_, NGHTTP2_FLAG_END_PUSH_PROMISE, return nghttp2_submit_push_promise(session_, NGHTTP2_FLAG_END_HEADERS,
req->stream_id, nva.data(), nva.size()); req->stream_id, nva.data(), nva.size());
} }

View File

@ -272,8 +272,8 @@ void print_flags(const nghttp2_frame_hd& hd)
} }
break; break;
case NGHTTP2_PUSH_PROMISE: case NGHTTP2_PUSH_PROMISE:
if(hd.flags & NGHTTP2_FLAG_END_PUSH_PROMISE) { if(hd.flags & NGHTTP2_FLAG_END_HEADERS) {
s += "END_PUSH_PROMISE"; s += "END_HEADERS";
} }
if(hd.flags & NGHTTP2_FLAG_PAD_LOW) { if(hd.flags & NGHTTP2_FLAG_PAD_LOW) {
if(!s.empty()) { if(!s.empty()) {

View File

@ -276,7 +276,7 @@ void test_nghttp2_frame_pack_push_promise()
nva = headers(); nva = headers();
nvlen = HEADERS_LENGTH; nvlen = HEADERS_LENGTH;
nghttp2_frame_push_promise_init(&frame, NGHTTP2_FLAG_END_PUSH_PROMISE, nghttp2_frame_push_promise_init(&frame, NGHTTP2_FLAG_END_HEADERS,
1000000007, (1U << 31) - 1, nva, nvlen); 1000000007, (1U << 31) - 1, nva, nvlen);
framelen = nghttp2_frame_pack_push_promise(&buf, &buflen, &bufoff, &frame, framelen = nghttp2_frame_pack_push_promise(&buf, &buflen, &bufoff, &frame,
&deflater); &deflater);
@ -285,7 +285,7 @@ void test_nghttp2_frame_pack_push_promise()
buf + bufoff, framelen - bufoff)); buf + bufoff, framelen - bufoff));
check_frame_header(framelen - bufoff - NGHTTP2_FRAME_HEAD_LENGTH, check_frame_header(framelen - bufoff - NGHTTP2_FRAME_HEAD_LENGTH,
NGHTTP2_PUSH_PROMISE, NGHTTP2_PUSH_PROMISE,
NGHTTP2_FLAG_END_PUSH_PROMISE, 1000000007, &oframe.hd); NGHTTP2_FLAG_END_HEADERS, 1000000007, &oframe.hd);
CU_ASSERT((1U << 31) - 1 == oframe.promised_stream_id); CU_ASSERT((1U << 31) - 1 == oframe.promised_stream_id);
nv_offset = bufoff + NGHTTP2_FRAME_HEAD_LENGTH + 4; nv_offset = bufoff + NGHTTP2_FRAME_HEAD_LENGTH + 4;

View File

@ -1511,7 +1511,7 @@ void test_nghttp2_session_on_push_promise_received(void)
NGHTTP2_PRI_DEFAULT, NGHTTP2_PRI_DEFAULT,
NGHTTP2_STREAM_OPENING, NULL); NGHTTP2_STREAM_OPENING, NULL);
nghttp2_frame_push_promise_init(&frame.push_promise, nghttp2_frame_push_promise_init(&frame.push_promise,
NGHTTP2_FLAG_END_PUSH_PROMISE, 1, 2, NGHTTP2_FLAG_END_HEADERS, 1, 2,
NULL, 0); NULL, 0);
user_data.begin_headers_cb_called = 0; user_data.begin_headers_cb_called = 0;
@ -1626,7 +1626,7 @@ void test_nghttp2_session_on_push_promise_received(void)
NGHTTP2_STREAM_RESERVED, NULL); NGHTTP2_STREAM_RESERVED, NULL);
/* Attempt to PUSH_PROMISE against reserved (remote) stream */ /* Attempt to PUSH_PROMISE against reserved (remote) stream */
nghttp2_frame_push_promise_init(&frame.push_promise, nghttp2_frame_push_promise_init(&frame.push_promise,
NGHTTP2_FLAG_END_PUSH_PROMISE, 2, 4, NGHTTP2_FLAG_END_HEADERS, 2, 4,
NULL, 0); NULL, 0);
user_data.begin_headers_cb_called = 0; user_data.begin_headers_cb_called = 0;
@ -1651,7 +1651,7 @@ void test_nghttp2_session_on_push_promise_received(void)
session->local_settings[NGHTTP2_SETTINGS_ENABLE_PUSH] = 0; session->local_settings[NGHTTP2_SETTINGS_ENABLE_PUSH] = 0;
nghttp2_frame_push_promise_init(&frame.push_promise, nghttp2_frame_push_promise_init(&frame.push_promise,
NGHTTP2_FLAG_END_PUSH_PROMISE, 1, 2, NGHTTP2_FLAG_END_HEADERS, 1, 2,
NULL, 0); NULL, 0);
user_data.begin_headers_cb_called = 0; user_data.begin_headers_cb_called = 0;
@ -1674,7 +1674,7 @@ void test_nghttp2_session_on_push_promise_received(void)
NGHTTP2_STREAM_OPENING, NULL); NGHTTP2_STREAM_OPENING, NULL);
nvlen = nghttp2_nv_array_copy(&nva, malformed_nva, ARRLEN(malformed_nva)); nvlen = nghttp2_nv_array_copy(&nva, malformed_nva, ARRLEN(malformed_nva));
nghttp2_frame_push_promise_init(&frame.push_promise, nghttp2_frame_push_promise_init(&frame.push_promise,
NGHTTP2_FLAG_END_PUSH_PROMISE, 1, 2, NGHTTP2_FLAG_END_HEADERS, 1, 2,
nva, nvlen); nva, nvlen);
user_data.begin_headers_cb_called = 0; user_data.begin_headers_cb_called = 0;
user_data.invalid_frame_recv_cb_called = 0; user_data.invalid_frame_recv_cb_called = 0;
@ -2018,7 +2018,7 @@ void test_nghttp2_session_send_push_promise(void)
NGHTTP2_PRI_DEFAULT, NGHTTP2_STREAM_OPENING, NGHTTP2_PRI_DEFAULT, NGHTTP2_STREAM_OPENING,
NULL); NULL);
nghttp2_frame_push_promise_init(&frame->push_promise, nghttp2_frame_push_promise_init(&frame->push_promise,
NGHTTP2_FLAG_END_PUSH_PROMISE, 1, -1, NGHTTP2_FLAG_END_HEADERS, 1, -1,
NULL, 0); NULL, 0);
nghttp2_session_add_frame(session, NGHTTP2_CAT_CTRL, frame, NULL); nghttp2_session_add_frame(session, NGHTTP2_CAT_CTRL, frame, NULL);
@ -2038,7 +2038,7 @@ void test_nghttp2_session_send_push_promise(void)
frame = malloc(sizeof(nghttp2_frame)); frame = malloc(sizeof(nghttp2_frame));
nghttp2_frame_push_promise_init(&frame->push_promise, nghttp2_frame_push_promise_init(&frame->push_promise,
NGHTTP2_FLAG_END_PUSH_PROMISE, 1, -1, NGHTTP2_FLAG_END_HEADERS, 1, -1,
NULL, 0); NULL, 0);
nghttp2_session_add_frame(session, NGHTTP2_CAT_CTRL, frame, NULL); nghttp2_session_add_frame(session, NGHTTP2_CAT_CTRL, frame, NULL);
ud.frame_not_send_cb_called = 0; ud.frame_not_send_cb_called = 0;
@ -2057,7 +2057,7 @@ void test_nghttp2_session_send_push_promise(void)
NULL); NULL);
frame = malloc(sizeof(nghttp2_frame)); frame = malloc(sizeof(nghttp2_frame));
nghttp2_frame_push_promise_init(&frame->push_promise, nghttp2_frame_push_promise_init(&frame->push_promise,
NGHTTP2_FLAG_END_PUSH_PROMISE, 1, -1, NGHTTP2_FLAG_END_HEADERS, 1, -1,
NULL, 0); NULL, 0);
nghttp2_session_add_frame(session, NGHTTP2_CAT_CTRL, frame, NULL); nghttp2_session_add_frame(session, NGHTTP2_CAT_CTRL, frame, NULL);
@ -2200,7 +2200,7 @@ void test_nghttp2_session_reprioritize_stream(void)
NGHTTP2_STREAM_OPENING, NULL); NGHTTP2_STREAM_OPENING, NULL);
CU_ASSERT(0 == nghttp2_submit_push_promise(session, CU_ASSERT(0 == nghttp2_submit_push_promise(session,
NGHTTP2_FLAG_END_PUSH_PROMISE, NGHTTP2_FLAG_END_HEADERS,
3, NULL, 0)); 3, NULL, 0));
ud.block_count = 0; ud.block_count = 0;
CU_ASSERT(0 == nghttp2_session_send(session)); CU_ASSERT(0 == nghttp2_session_send(session));