Skip to content

Commit

Permalink
Allow server initiated stream ID in associated-stream-id
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsuhiro-t committed Apr 5, 2013
1 parent 34e119f commit f47bf21
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
4 changes: 1 addition & 3 deletions lib/spdylay_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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. */
Expand Down
8 changes: 2 additions & 6 deletions lib/spdylay_submit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions tests/spdylay_session_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit f47bf21

Please sign in to comment.