Explicitly treat stream_id 0 as error in nghttp2_session_change_stream_priority
This commit is contained in:
parent
b53b1381b7
commit
b08d5b1975
|
@ -2879,8 +2879,8 @@ NGHTTP2_EXTERN int nghttp2_session_consume_stream(nghttp2_session *session,
|
||||||
* :enum:`NGHTTP2_ERR_NOMEM`
|
* :enum:`NGHTTP2_ERR_NOMEM`
|
||||||
* Out of memory.
|
* Out of memory.
|
||||||
* :enum:`NGHTTP2_ERR_INVALID_ARGUMENT`
|
* :enum:`NGHTTP2_ERR_INVALID_ARGUMENT`
|
||||||
* Attempted to depend on itself; no stream exist for the given
|
* Attempted to depend on itself; or no stream exist for the given
|
||||||
* |stream_id|.
|
* |stream_id|; or |stream_id| is 0
|
||||||
*/
|
*/
|
||||||
NGHTTP2_EXTERN int
|
NGHTTP2_EXTERN int
|
||||||
nghttp2_session_change_stream_priority(nghttp2_session *session,
|
nghttp2_session_change_stream_priority(nghttp2_session *session,
|
||||||
|
|
|
@ -6789,7 +6789,7 @@ int nghttp2_session_change_stream_priority(
|
||||||
nghttp2_stream *stream;
|
nghttp2_stream *stream;
|
||||||
nghttp2_priority_spec pri_spec_copy;
|
nghttp2_priority_spec pri_spec_copy;
|
||||||
|
|
||||||
if (stream_id == pri_spec->stream_id) {
|
if (stream_id == 0 || stream_id == pri_spec->stream_id) {
|
||||||
return NGHTTP2_ERR_INVALID_ARGUMENT;
|
return NGHTTP2_ERR_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8379,6 +8379,10 @@ void test_nghttp2_session_change_stream_priority(void) {
|
||||||
rv = nghttp2_session_change_stream_priority(session, 1, &pri_spec);
|
rv = nghttp2_session_change_stream_priority(session, 1, &pri_spec);
|
||||||
CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv);
|
CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv);
|
||||||
|
|
||||||
|
/* It is an error to change priority of root stream (0) */
|
||||||
|
rv = nghttp2_session_change_stream_priority(session, 0, &pri_spec);
|
||||||
|
CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv);
|
||||||
|
|
||||||
nghttp2_session_del(session);
|
nghttp2_session_del(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue