From 29df087ae883edf78c3e92d2a55b291fd467673e Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 27 Jan 2012 17:22:17 +0900 Subject: [PATCH] Set FIN bit set in stream when requet DATA frame with FIN bit set is sent. --- lib/spdylay_session.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/spdylay_session.c b/lib/spdylay_session.c index af71bc0..3ad3bce 100644 --- a/lib/spdylay_session.c +++ b/lib/spdylay_session.c @@ -390,10 +390,20 @@ static int spdylay_session_after_frame_sent(spdylay_session *session) spdylay_session_close_stream(session, frame->rst_stream.stream_id); break; case SPDYLAY_DATA: - if((frame->data.flags & SPDYLAY_FLAG_FIN) && - !spdylay_session_is_my_stream_id(session, frame->data.stream_id)) { - /* We send all data requested by peer, so close the stream. */ - spdylay_session_close_stream(session, frame->data.stream_id); + if(frame->data.flags & SPDYLAY_FLAG_FIN) { + if(spdylay_session_is_my_stream_id(session, frame->data.stream_id)) { + /* This is the last frame of request DATA (e.g., POST in HTTP + term), so set FIN bit set in stream. This also happens when + request HEADERS frame is sent with FIN bit set. */ + spdylay_stream *stream = + spdylay_session_get_stream(session, frame->data.stream_id); + if(stream) { + stream->flags |= SPDYLAY_FLAG_FIN; + } + } else { + /* We send all data requested by peer, so close the stream. */ + spdylay_session_close_stream(session, frame->data.stream_id); + } } break; };