mirror of
https://github.com/nghttp2/nghttp2.git
synced 2025-12-08 19:18:53 +08:00
Implement SETTINGS_ENABLE_PUSH
It is not clear that SETTINGS_ENABLE_PUSH = 0 disallows HEADERS to the reserved streams. For now, we just check the reception and transmission of PUSH_PROMISE against SETTINGS_ENABLE_PUSH.
This commit is contained in:
@@ -274,6 +274,10 @@ typedef enum {
|
||||
* transmission of SETTINGS is allowed.
|
||||
*/
|
||||
NGHTTP2_ERR_TOO_MANY_INFLIGHT_SETTINGS = -527,
|
||||
/**
|
||||
* The server push is disabled.
|
||||
*/
|
||||
NGHTTP2_ERR_PUSH_DISABLED = -528,
|
||||
/**
|
||||
* The errors < :enum:`NGHTTP2_ERR_FATAL` mean that the library is
|
||||
* under unexpected condition and cannot process any further data
|
||||
|
||||
@@ -865,6 +865,8 @@ static int nghttp2_session_predicate_priority_send
|
||||
* NGHTTP2_ERR_STREAM_SHUT_WR
|
||||
* The transmission is not allowed for this stream (e.g., a frame
|
||||
* with END_STREAM flag set has already sent)
|
||||
* NGHTTP2_ERR_PUSH_DISABLED
|
||||
* The remote peer disabled reception of PUSH_PROMISE.
|
||||
*/
|
||||
static int nghttp2_session_predicate_push_promise_send
|
||||
(nghttp2_session *session, int32_t stream_id)
|
||||
@@ -881,6 +883,9 @@ static int nghttp2_session_predicate_push_promise_send
|
||||
if(rv != 0) {
|
||||
return rv;
|
||||
}
|
||||
if(session->remote_settings[NGHTTP2_SETTINGS_ENABLE_PUSH] == 0) {
|
||||
return NGHTTP2_ERR_PUSH_DISABLED;
|
||||
}
|
||||
if(stream->state == NGHTTP2_STREAM_CLOSING) {
|
||||
return NGHTTP2_ERR_STREAM_CLOSING;
|
||||
}
|
||||
@@ -2488,6 +2493,10 @@ int nghttp2_session_on_push_promise_received(nghttp2_session *session,
|
||||
return nghttp2_session_handle_invalid_connection(session, frame,
|
||||
NGHTTP2_INTERNAL_ERROR);
|
||||
}
|
||||
if(session->local_settings[NGHTTP2_SETTINGS_ENABLE_PUSH] == 0) {
|
||||
return nghttp2_session_handle_invalid_connection(session, frame,
|
||||
NGHTTP2_PROTOCOL_ERROR);
|
||||
}
|
||||
if(session->goaway_flags) {
|
||||
/* We just dicard PUSH_PROMISE after GOAWAY is sent or
|
||||
received. */
|
||||
|
||||
Reference in New Issue
Block a user