Allow server initiated stream ID in associated-stream-id

This commit is contained in:
Tatsuhiro Tsujikawa 2013-04-05 23:24:28 +09:00
parent 34e119fde2
commit f47bf214e5
3 changed files with 3 additions and 14 deletions

View File

@ -586,8 +586,7 @@ static int spdylay_session_predicate_syn_stream_send
if(frame->assoc_stream_id != 0) {
/* Check associated stream is active. */
/* We assume here that if frame->assoc_stream_id != 0,
session->server is always 1 and frame->assoc_stream_id is
odd. */
session->server is always 1. */
if(spdylay_session_get_stream(session, frame->assoc_stream_id) ==
NULL) {
return SPDYLAY_ERR_STREAM_CLOSED;
@ -1642,7 +1641,6 @@ static int spdylay_session_validate_syn_stream(spdylay_session *session,
return SPDYLAY_INVALID_STREAM;
}
if((frame->hd.flags & SPDYLAY_CTRL_FLAG_UNIDIRECTIONAL) == 0 ||
frame->assoc_stream_id % 2 == 0 ||
spdylay_session_get_stream(session, frame->assoc_stream_id) == NULL) {
/* It seems spdy/2 spec does not say which status code should be
returned in these cases. */

View File

@ -48,12 +48,8 @@ static int spdylay_submit_syn_stream_shared
if(pri > spdylay_session_get_pri_lowest(session)) {
return SPDYLAY_ERR_INVALID_ARGUMENT;
}
if(assoc_stream_id != 0) {
if(session->server == 0) {
assoc_stream_id = 0;
} else if(spdylay_session_is_my_stream_id(session, assoc_stream_id)) {
return SPDYLAY_ERR_INVALID_ARGUMENT;
}
if(assoc_stream_id != 0 && session->server == 0) {
assoc_stream_id = 0;
}
if(!spdylay_frame_nv_check_null(nv)) {
return SPDYLAY_ERR_INVALID_ARGUMENT;

View File

@ -977,11 +977,6 @@ void test_spdylay_submit_syn_stream(void)
CU_ASSERT(1 == OB_CTRL(item)->syn_stream.assoc_stream_id);
CU_ASSERT(3 == OB_CTRL(item)->syn_stream.pri);
/* Invalid assoc-stream-ID */
CU_ASSERT(SPDYLAY_ERR_INVALID_ARGUMENT ==
spdylay_submit_syn_stream(session, SPDYLAY_CTRL_FLAG_FIN, 2, 3,
nv, NULL));
spdylay_session_del(session);
}