From f47bf214e59b78771f707a59e1a7cbecb70a9baa Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 5 Apr 2013 23:24:28 +0900 Subject: [PATCH] Allow server initiated stream ID in associated-stream-id --- lib/spdylay_session.c | 4 +--- lib/spdylay_submit.c | 8 ++------ tests/spdylay_session_test.c | 5 ----- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/lib/spdylay_session.c b/lib/spdylay_session.c index e9d96fb..f4d6961 100644 --- a/lib/spdylay_session.c +++ b/lib/spdylay_session.c @@ -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. */ diff --git a/lib/spdylay_submit.c b/lib/spdylay_submit.c index 5cfcf75..3ac1bf6 100644 --- a/lib/spdylay_submit.c +++ b/lib/spdylay_submit.c @@ -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; diff --git a/tests/spdylay_session_test.c b/tests/spdylay_session_test.c index 880c80e..1c081b9 100644 --- a/tests/spdylay_session_test.c +++ b/tests/spdylay_session_test.c @@ -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); }