Disallow PUSH_PROMISE from client side

This commit is contained in:
Tatsuhiro Tsujikawa 2014-02-14 16:12:04 +09:00
parent 7ab4206269
commit 622f783675
1 changed files with 5 additions and 1 deletions

View File

@ -912,6 +912,9 @@ static int nghttp2_session_predicate_push_promise_send
{
int rv;
nghttp2_stream *stream;
if(!session->server) {
return NGHTTP2_ERR_PROTO;
}
if(nghttp2_session_is_my_stream_id(session, stream_id)) {
/* The associated stream must be initiated by the remote peer */
return NGHTTP2_ERR_PROTO;
@ -2861,7 +2864,8 @@ int nghttp2_session_on_push_promise_received(nghttp2_session *session,
return nghttp2_session_inflate_handle_invalid_connection
(session, frame, NGHTTP2_PROTOCOL_ERROR);
}
if(session->local_settings[NGHTTP2_SETTINGS_ENABLE_PUSH] == 0) {
if(session->server ||
session->local_settings[NGHTTP2_SETTINGS_ENABLE_PUSH] == 0) {
return nghttp2_session_inflate_handle_invalid_connection
(session, frame, NGHTTP2_PROTOCOL_ERROR);
}