Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
cf7da385
Commit
cf7da385
authored
Feb 24, 2012
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define flags separately for control and data frames.
parent
946e6f41
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
152 additions
and
136 deletions
+152
-136
lib/includes/spdylay/spdylay.h
lib/includes/spdylay/spdylay.h
+20
-14
lib/spdylay_frame.c
lib/spdylay_frame.c
+1
-1
lib/spdylay_session.c
lib/spdylay_session.c
+24
-23
lib/spdylay_session.h
lib/spdylay_session.h
+9
-8
lib/spdylay_submit.c
lib/spdylay_submit.c
+10
-10
tests/spdylay_frame_test.c
tests/spdylay_frame_test.c
+3
-3
tests/spdylay_session_test.c
tests/spdylay_session_test.c
+83
-75
tests/spdylay_stream_test.c
tests/spdylay_stream_test.c
+2
-2
No files found.
lib/includes/spdylay/spdylay.h
View file @
cf7da385
...
...
@@ -74,10 +74,15 @@ typedef enum {
}
spdylay_frame_type
;
typedef
enum
{
SPDYLAY_FLAG_NONE
=
0
,
SPDYLAY_FLAG_FIN
=
1
,
SPDYLAY_FLAG_UNIDIRECTIONAL
=
2
}
spdylay_flag
;
SPDYLAY_CTRL_FLAG_NONE
=
0
,
SPDYLAY_CTRL_FLAG_FIN
=
0x1
,
SPDYLAY_CTRL_FLAG_UNIDIRECTIONAL
=
0x2
}
spdylay_ctrl_flag
;
typedef
enum
{
SPDYLAY_DATA_FLAG_NONE
=
0
,
SPDYLAY_DATA_FLAG_FIN
=
0x1
}
spdylay_data_flag
;
typedef
enum
{
SPDYLAY_FLAG_SETTINGS_NONE
=
0
,
...
...
@@ -271,10 +276,9 @@ typedef void (*spdylay_on_invalid_ctrl_recv_callback)
* Callback function invoked when data chunk of DATA frame is
* received. |stream_id| is the stream ID of this DATA frame belongs
* to. |flags| is the flags of DATA frame which this data chunk is
* contained. flags & SPDYLAY_FLAG_FIN does not necessarily mean this
* chunk of data is the last one in the stream. You should use
* spdylay_on_data_recv_callback to know all data frame is received
* whose flags contains SPDYLAY_FLAG_FIN.
* contained. flags & SPDYLAY_DATA_FLAG_FIN does not necessarily mean
* this chunk of data is the last one in the stream. You should use
* spdylay_on_data_recv_callback to know all data frames are received.
*/
typedef
void
(
*
spdylay_on_data_chunk_recv_callback
)
(
spdylay_session
*
session
,
uint8_t
flags
,
int32_t
stream_id
,
...
...
@@ -515,10 +519,11 @@ int spdylay_submit_response(spdylay_session *session,
* Submits SYN_STREAM frame. The |flags| is bitwise OR of the
* following values:
*
* SPDYLAY_FLAG_FIN
* SPDYLAY_FLAG_UNIDIRECTIONAL
* SPDYLAY_
CTRL_
FLAG_FIN
* SPDYLAY_
CTRL_
FLAG_UNIDIRECTIONAL
*
* If |flags| includes SPDYLAY_FLAG_FIN, this frame has FIN flag set.
* If |flags| includes SPDYLAY_CTRL_FLAG_FIN, this frame has FIN flag
* set.
*
* The |assoc_stream_id| is used for server-push. If |session| is
* initialized for client use, |assoc_stream_id| is ignored. The |pri|
...
...
@@ -547,9 +552,10 @@ int spdylay_submit_syn_stream(spdylay_session *session, uint8_t flags,
* Submits HEADERS frame. The |flags| is bitwise OR of the following
* values:
*
* SPDYLAY_FLAG_FIN
* SPDYLAY_
CTRL_
FLAG_FIN
*
* If |flags| includes SPDYLAY_FLAG_FIN, this frame has FIN flag set.
* If |flags| includes SPDYLAY_CTRL_FLAG_FIN, this frame has FIN flag
* set.
*
* The stream this frame belongs to is given in |stream_id|. The |nv|
* is the name/value pairs in this frame.
...
...
@@ -567,7 +573,7 @@ int spdylay_submit_headers(spdylay_session *session, uint8_t flags,
* Submits 1 or more DATA frames to the stream |stream_id|. The data
* to be sent are provided by |data_prd|. Depending on the length of
* data, 1 or more DATA frames will be sent. If |flags| contains
* SPDYLAY_FLAG_FIN, the last DATA frame has FLAG_FIN set.
* SPDYLAY_
DATA_
FLAG_FIN, the last DATA frame has FLAG_FIN set.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
...
...
lib/spdylay_frame.c
View file @
cf7da385
...
...
@@ -408,7 +408,7 @@ void spdylay_frame_ping_init(spdylay_ping *frame, uint32_t unique_id)
memset
(
frame
,
0
,
sizeof
(
spdylay_ping
));
frame
->
hd
.
version
=
SPDYLAY_PROTO_VERSION
;
frame
->
hd
.
type
=
SPDYLAY_PING
;
frame
->
hd
.
flags
=
SPDYLAY_FLAG_NONE
;
frame
->
hd
.
flags
=
SPDYLAY_
CTRL_
FLAG_NONE
;
frame
->
hd
.
length
=
4
;
frame
->
unique_id
=
unique_id
;
}
...
...
lib/spdylay_session.c
View file @
cf7da385
...
...
@@ -715,7 +715,7 @@ static int spdylay_session_after_frame_sent(spdylay_session *session)
session
->
callbacks
.
on_data_send_callback
(
session
,
frame
->
data
.
eof
?
frame
->
data
.
flags
:
(
frame
->
data
.
flags
&
(
~
SPDYLAY_FLAG_FIN
)),
(
frame
->
data
.
flags
&
(
~
SPDYLAY_
DATA_
FLAG_FIN
)),
frame
->
data
.
stream_id
,
session
->
aob
.
framebuflen
-
SPDYLAY_HEAD_LEN
,
session
->
user_data
);
}
...
...
@@ -732,10 +732,10 @@ static int spdylay_session_after_frame_sent(spdylay_session *session)
if
(
stream
)
{
spdylay_syn_stream_aux_data
*
aux_data
;
stream
->
state
=
SPDYLAY_STREAM_OPENING
;
if
(
frame
->
syn_stream
.
hd
.
flags
&
SPDYLAY_FLAG_FIN
)
{
if
(
frame
->
syn_stream
.
hd
.
flags
&
SPDYLAY_
CTRL_
FLAG_FIN
)
{
spdylay_stream_shutdown
(
stream
,
SPDYLAY_SHUT_WR
);
}
if
(
frame
->
syn_stream
.
hd
.
flags
&
SPDYLAY_FLAG_UNIDIRECTIONAL
)
{
if
(
frame
->
syn_stream
.
hd
.
flags
&
SPDYLAY_
CTRL_
FLAG_UNIDIRECTIONAL
)
{
spdylay_stream_shutdown
(
stream
,
SPDYLAY_SHUT_RD
);
}
spdylay_session_close_stream_if_shut_rdwr
(
session
,
stream
);
...
...
@@ -745,7 +745,7 @@ static int spdylay_session_after_frame_sent(spdylay_session *session)
int
r
;
/* spdylay_submit_data() makes a copy of aux_data->data_prd */
r
=
spdylay_submit_data
(
session
,
frame
->
syn_stream
.
stream_id
,
SPDYLAY_FLAG_FIN
,
aux_data
->
data_prd
);
SPDYLAY_
DATA_
FLAG_FIN
,
aux_data
->
data_prd
);
if
(
r
!=
0
)
{
/* FATAL error */
assert
(
r
<
SPDYLAY_ERR_FATAL
);
...
...
@@ -761,7 +761,7 @@ static int spdylay_session_after_frame_sent(spdylay_session *session)
spdylay_session_get_stream
(
session
,
frame
->
syn_reply
.
stream_id
);
if
(
stream
)
{
stream
->
state
=
SPDYLAY_STREAM_OPENED
;
if
(
frame
->
syn_reply
.
hd
.
flags
&
SPDYLAY_FLAG_FIN
)
{
if
(
frame
->
syn_reply
.
hd
.
flags
&
SPDYLAY_
CTRL_
FLAG_FIN
)
{
spdylay_stream_shutdown
(
stream
,
SPDYLAY_SHUT_WR
);
}
spdylay_session_close_stream_if_shut_rdwr
(
session
,
stream
);
...
...
@@ -771,7 +771,7 @@ static int spdylay_session_after_frame_sent(spdylay_session *session)
(
spdylay_data_provider
*
)
item
->
aux_data
;
int
r
;
r
=
spdylay_submit_data
(
session
,
frame
->
syn_reply
.
stream_id
,
SPDYLAY_FLAG_FIN
,
data_prd
);
SPDYLAY_
DATA_
FLAG_FIN
,
data_prd
);
if
(
r
!=
0
)
{
/* FATAL error */
assert
(
r
<
SPDYLAY_ERR_FATAL
);
...
...
@@ -811,7 +811,7 @@ static int spdylay_session_after_frame_sent(spdylay_session *session)
spdylay_stream
*
stream
=
spdylay_session_get_stream
(
session
,
frame
->
headers
.
stream_id
);
if
(
stream
)
{
if
(
frame
->
headers
.
hd
.
flags
&
SPDYLAY_FLAG_FIN
)
{
if
(
frame
->
headers
.
hd
.
flags
&
SPDYLAY_
CTRL_
FLAG_FIN
)
{
spdylay_stream_shutdown
(
stream
,
SPDYLAY_SHUT_WR
);
}
spdylay_session_close_stream_if_shut_rdwr
(
session
,
stream
);
...
...
@@ -819,7 +819,7 @@ static int spdylay_session_after_frame_sent(spdylay_session *session)
break
;
}
case
SPDYLAY_DATA
:
if
(
frame
->
data
.
eof
&&
(
frame
->
data
.
flags
&
SPDYLAY_FLAG_FIN
))
{
if
(
frame
->
data
.
eof
&&
(
frame
->
data
.
flags
&
SPDYLAY_
DATA_
FLAG_FIN
))
{
spdylay_stream
*
stream
=
spdylay_session_get_stream
(
session
,
frame
->
data
.
stream_id
);
if
(
stream
)
{
...
...
@@ -1078,7 +1078,7 @@ static int spdylay_session_validate_syn_stream(spdylay_session *session,
a RST_STREAM with error code INVALID_STREAM. */
return
SPDYLAY_INVALID_STREAM
;
}
if
((
frame
->
hd
.
flags
&
SPDYLAY_FLAG_UNIDIRECTIONAL
)
==
0
||
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
...
...
@@ -1133,7 +1133,8 @@ int spdylay_session_on_syn_stream_received(spdylay_session *session,
&
frame
->
syn_stream
);
if
(
status_code
==
0
)
{
uint8_t
flags
=
frame
->
syn_stream
.
hd
.
flags
;
if
((
flags
&
SPDYLAY_FLAG_FIN
)
&&
(
flags
&
SPDYLAY_FLAG_UNIDIRECTIONAL
))
{
if
((
flags
&
SPDYLAY_CTRL_FLAG_FIN
)
&&
(
flags
&
SPDYLAY_CTRL_FLAG_UNIDIRECTIONAL
))
{
/* If the stream is UNIDIRECTIONAL and FIN bit set, we can close
stream upon receiving SYN_STREAM. So, the stream needs not to
be opened. */
...
...
@@ -1145,24 +1146,24 @@ int spdylay_session_on_syn_stream_received(spdylay_session *session,
SPDYLAY_STREAM_OPENING
,
NULL
);
if
(
stream
)
{
if
(
flags
&
SPDYLAY_FLAG_FIN
)
{
if
(
flags
&
SPDYLAY_
CTRL_
FLAG_FIN
)
{
spdylay_stream_shutdown
(
stream
,
SPDYLAY_SHUT_RD
);
}
if
(
flags
&
SPDYLAY_FLAG_UNIDIRECTIONAL
)
{
if
(
flags
&
SPDYLAY_
CTRL_
FLAG_UNIDIRECTIONAL
)
{
spdylay_stream_shutdown
(
stream
,
SPDYLAY_SHUT_WR
);
}
/* We don't call spdylay_session_close_stream_if_shut_rdwr()
here because either SPDYLAY_FLAG_FIN or
SPDYLAY_FLAG_UNIDIRECTIONAL is not set here. */
here because either SPDYLAY_
CTRL_
FLAG_FIN or
SPDYLAY_
CTRL_
FLAG_UNIDIRECTIONAL is not set here. */
}
}
session
->
last_recv_stream_id
=
frame
->
syn_stream
.
stream_id
;
spdylay_session_call_on_ctrl_frame_received
(
session
,
SPDYLAY_SYN_STREAM
,
frame
);
if
(
flags
&
SPDYLAY_FLAG_FIN
)
{
if
(
flags
&
SPDYLAY_
CTRL_
FLAG_FIN
)
{
spdylay_session_call_on_request_recv
(
session
,
frame
->
syn_stream
.
stream_id
);
if
(
flags
&
SPDYLAY_FLAG_UNIDIRECTIONAL
)
{
if
(
flags
&
SPDYLAY_
CTRL_
FLAG_UNIDIRECTIONAL
)
{
/* Note that we call on_stream_close_callback without opening
stream. */
if
(
session
->
callbacks
.
on_stream_close_callback
)
{
...
...
@@ -1199,7 +1200,7 @@ int spdylay_session_on_syn_reply_received(spdylay_session *session,
stream
->
state
=
SPDYLAY_STREAM_OPENED
;
spdylay_session_call_on_ctrl_frame_received
(
session
,
SPDYLAY_SYN_REPLY
,
frame
);
if
(
frame
->
syn_reply
.
hd
.
flags
&
SPDYLAY_FLAG_FIN
)
{
if
(
frame
->
syn_reply
.
hd
.
flags
&
SPDYLAY_
CTRL_
FLAG_FIN
)
{
/* This is the last frame of this stream, so disallow
further receptions. */
spdylay_stream_shutdown
(
stream
,
SPDYLAY_SHUT_RD
);
...
...
@@ -1303,7 +1304,7 @@ int spdylay_session_on_headers_received(spdylay_session *session,
valid
=
1
;
spdylay_session_call_on_ctrl_frame_received
(
session
,
SPDYLAY_HEADERS
,
frame
);
if
(
frame
->
headers
.
hd
.
flags
&
SPDYLAY_FLAG_FIN
)
{
if
(
frame
->
headers
.
hd
.
flags
&
SPDYLAY_
CTRL_
FLAG_FIN
)
{
spdylay_stream_shutdown
(
stream
,
SPDYLAY_SHUT_RD
);
spdylay_session_close_stream_if_shut_rdwr
(
session
,
stream
);
}
...
...
@@ -1322,7 +1323,7 @@ int spdylay_session_on_headers_received(spdylay_session *session,
if
(
stream
->
state
!=
SPDYLAY_STREAM_CLOSING
)
{
spdylay_session_call_on_ctrl_frame_received
(
session
,
SPDYLAY_HEADERS
,
frame
);
if
(
frame
->
headers
.
hd
.
flags
&
SPDYLAY_FLAG_FIN
)
{
if
(
frame
->
headers
.
hd
.
flags
&
SPDYLAY_
CTRL_
FLAG_FIN
)
{
spdylay_session_call_on_request_recv
(
session
,
frame
->
headers
.
stream_id
);
spdylay_stream_shutdown
(
stream
,
SPDYLAY_SHUT_RD
);
...
...
@@ -1516,12 +1517,12 @@ int spdylay_session_on_data_received(spdylay_session *session,
session
->
callbacks
.
on_data_recv_callback
(
session
,
flags
,
stream_id
,
length
,
session
->
user_data
);
}
if
(
flags
&
SPDYLAY_FLAG_FIN
)
{
if
(
flags
&
SPDYLAY_
DATA_
FLAG_FIN
)
{
spdylay_session_call_on_request_recv
(
session
,
stream_id
);
}
}
if
(
valid
)
{
if
(
flags
&
SPDYLAY_FLAG_FIN
)
{
if
(
flags
&
SPDYLAY_
DATA_
FLAG_FIN
)
{
spdylay_stream_shutdown
(
stream
,
SPDYLAY_SHUT_RD
);
spdylay_session_close_stream_if_shut_rdwr
(
session
,
stream
);
}
...
...
@@ -1754,8 +1755,8 @@ ssize_t spdylay_session_pack_data(spdylay_session *session,
flags
=
0
;
if
(
eof
)
{
frame
->
eof
=
1
;
if
(
frame
->
flags
&
SPDYLAY_FLAG_FIN
)
{
flags
|=
SPDYLAY_FLAG_FIN
;
if
(
frame
->
flags
&
SPDYLAY_
DATA_
FLAG_FIN
)
{
flags
|=
SPDYLAY_
DATA_
FLAG_FIN
;
}
}
(
*
buf_ptr
)[
4
]
=
flags
;
...
...
lib/spdylay_session.h
View file @
cf7da385
...
...
@@ -224,14 +224,15 @@ int spdylay_session_add_goaway(spdylay_session *session,
/*
* Creates new stream in |session| with stream ID |stream_id|,
* priority |pri| and flags |flags|. SPDYLAY_FLAG_UNIDIRECTIONAL flag
* is set in |flags|, this stream is unidirectional. SPDYLAY_FLAG_FIN
* flag is set in |flags|, the sender of SYN_STREAM will not send any
* further data in this stream. Since this function is called when
* SYN_STREAM is sent or received, these flags are taken from
* SYN_STREAM. The state of stream is set to |initial_state|.
* |stream_user_data| is a pointer to the arbitrary user supplied data
* to be associated to this stream.
* priority |pri| and flags |flags|. SPDYLAY_CTRL_FLAG_UNIDIRECTIONAL
* flag is set in |flags|, this stream is
* unidirectional. SPDYLAY_CTRL_FLAG_FIN flag is set in |flags|, the
* sender of SYN_STREAM will not send any further data in this
* stream. Since this function is called when SYN_STREAM is sent or
* received, these flags are taken from SYN_STREAM. The state of
* stream is set to |initial_state|. |stream_user_data| is a pointer
* to the arbitrary user supplied data to be associated to this
* stream.
*
* This function returns a pointer to created new stream object, or
* NULL.
...
...
lib/spdylay_submit.c
View file @
cf7da385
...
...
@@ -79,11 +79,11 @@ static int spdylay_submit_syn_stream_shared
spdylay_frame_nv_downcase
(
nv_copy
);
spdylay_frame_nv_sort
(
nv_copy
);
flags_copy
=
0
;
if
(
flags
&
SPDYLAY_FLAG_FIN
)
{
flags_copy
|=
SPDYLAY_FLAG_FIN
;
if
(
flags
&
SPDYLAY_
CTRL_
FLAG_FIN
)
{
flags_copy
|=
SPDYLAY_
CTRL_
FLAG_FIN
;
}
if
(
flags
&
SPDYLAY_FLAG_UNIDIRECTIONAL
)
{
flags_copy
|=
SPDYLAY_FLAG_UNIDIRECTIONAL
;
if
(
flags
&
SPDYLAY_
CTRL_
FLAG_UNIDIRECTIONAL
)
{
flags_copy
|=
SPDYLAY_
CTRL_
FLAG_UNIDIRECTIONAL
;
}
spdylay_frame_syn_stream_init
(
&
frame
->
syn_stream
,
flags_copy
,
0
,
assoc_stream_id
,
pri
,
nv_copy
);
...
...
@@ -125,8 +125,8 @@ int spdylay_submit_headers(spdylay_session *session, uint8_t flags,
spdylay_frame_nv_downcase
(
nv_copy
);
spdylay_frame_nv_sort
(
nv_copy
);
flags_copy
=
0
;
if
(
flags
&
SPDYLAY_FLAG_FIN
)
{
flags_copy
|=
SPDYLAY_FLAG_FIN
;
if
(
flags
&
SPDYLAY_
CTRL_
FLAG_FIN
)
{
flags_copy
|=
SPDYLAY_
CTRL_
FLAG_FIN
;
}
spdylay_frame_headers_init
(
&
frame
->
headers
,
flags_copy
,
stream_id
,
nv_copy
);
r
=
spdylay_session_add_frame
(
session
,
SPDYLAY_HEADERS
,
frame
,
NULL
);
...
...
@@ -162,7 +162,7 @@ int spdylay_submit_request(spdylay_session *session, uint8_t pri,
int
flags
;
flags
=
0
;
if
(
data_prd
==
NULL
||
data_prd
->
read_callback
==
NULL
)
{
flags
|=
SPDYLAY_FLAG_FIN
;
flags
|=
SPDYLAY_
CTRL_
FLAG_FIN
;
}
return
spdylay_submit_syn_stream_shared
(
session
,
flags
,
0
,
pri
,
nv
,
data_prd
,
stream_user_data
);
...
...
@@ -198,7 +198,7 @@ int spdylay_submit_response(spdylay_session *session,
spdylay_frame_nv_downcase
(
nv_copy
);
spdylay_frame_nv_sort
(
nv_copy
);
if
(
data_prd_copy
==
NULL
)
{
flags
|=
SPDYLAY_FLAG_FIN
;
flags
|=
SPDYLAY_
CTRL_
FLAG_FIN
;
}
spdylay_frame_syn_reply_init
(
&
frame
->
syn_reply
,
flags
,
stream_id
,
nv_copy
);
...
...
@@ -223,8 +223,8 @@ int spdylay_submit_data(spdylay_session *session, int32_t stream_id,
if
(
frame
==
NULL
)
{
return
SPDYLAY_ERR_NOMEM
;
}
if
(
flags
&
SPDYLAY_FLAG_FIN
)
{
nflags
|=
SPDYLAY_FLAG_FIN
;
if
(
flags
&
SPDYLAY_
DATA_
FLAG_FIN
)
{
nflags
|=
SPDYLAY_
DATA_
FLAG_FIN
;
}
spdylay_frame_data_init
(
&
frame
->
data
,
stream_id
,
nflags
,
data_prd
);
r
=
spdylay_session_add_frame
(
session
,
SPDYLAY_DATA
,
frame
,
NULL
);
...
...
tests/spdylay_frame_test.c
View file @
cf7da385
...
...
@@ -218,7 +218,7 @@ void test_spdylay_frame_pack_goaway()
CU_ASSERT
(
1000000007
==
oframe
.
goaway
.
last_good_stream_id
);
CU_ASSERT
(
SPDYLAY_PROTO_VERSION
==
oframe
.
headers
.
hd
.
version
);
CU_ASSERT
(
SPDYLAY_GOAWAY
==
oframe
.
headers
.
hd
.
type
);
CU_ASSERT
(
SPDYLAY_FLAG_NONE
==
oframe
.
headers
.
hd
.
flags
);
CU_ASSERT
(
SPDYLAY_
CTRL_
FLAG_NONE
==
oframe
.
headers
.
hd
.
flags
);
CU_ASSERT
(
framelen
-
SPDYLAY_FRAME_HEAD_LENGTH
==
oframe
.
ping
.
hd
.
length
);
free
(
buf
);
spdylay_frame_goaway_free
(
&
oframe
.
goaway
);
...
...
@@ -236,7 +236,7 @@ void test_spdylay_frame_pack_headers()
spdylay_buffer_init
(
&
inflatebuf
,
4096
);
spdylay_zlib_deflate_hd_init
(
&
deflater
);
spdylay_zlib_inflate_hd_init
(
&
inflater
);
spdylay_frame_headers_init
(
&
frame
.
headers
,
SPDYLAY_FLAG_FIN
,
3
,
spdylay_frame_headers_init
(
&
frame
.
headers
,
SPDYLAY_
CTRL_
FLAG_FIN
,
3
,
spdylay_frame_nv_copy
(
headers
));
framelen
=
spdylay_frame_pack_headers
(
&
buf
,
&
buflen
,
&
nvbuf
,
&
nvbuflen
,
...
...
@@ -252,7 +252,7 @@ void test_spdylay_frame_pack_headers()
CU_ASSERT
(
3
==
oframe
.
headers
.
stream_id
);
CU_ASSERT
(
SPDYLAY_PROTO_VERSION
==
oframe
.
headers
.
hd
.
version
);
CU_ASSERT
(
SPDYLAY_HEADERS
==
oframe
.
headers
.
hd
.
type
);
CU_ASSERT
(
SPDYLAY_FLAG_FIN
==
oframe
.
headers
.
hd
.
flags
);
CU_ASSERT
(
SPDYLAY_
CTRL_
FLAG_FIN
==
oframe
.
headers
.
hd
.
flags
);
CU_ASSERT
(
framelen
-
SPDYLAY_FRAME_HEAD_LENGTH
==
oframe
.
ping
.
hd
.
length
);
CU_ASSERT
(
strcmp
(
"method"
,
oframe
.
headers
.
nv
[
0
])
==
0
);
CU_ASSERT
(
strcmp
(
"GET"
,
oframe
.
headers
.
nv
[
1
])
==
0
);
...
...
tests/spdylay_session_test.c
View file @
cf7da385
This diff is collapsed.
Click to expand it.
tests/spdylay_stream_test.c
View file @
cf7da385
...
...
@@ -32,8 +32,8 @@ void test_spdylay_stream_add_pushed_stream()
{
spdylay_stream
stream
;
int
i
,
n
;
spdylay_stream_init
(
&
stream
,
1
,
SPDYLAY_
FLAG_NONE
,
3
,
SPDYLAY_STREAM_OPENING
,
NULL
);
spdylay_stream_init
(
&
stream
,
1
,
SPDYLAY_
CTRL_FLAG_NONE
,
3
,
SPDYLAY_STREAM_OPENING
,
NULL
);
n
=
26
;
for
(
i
=
2
;
i
<
n
;
i
+=
2
)
{
CU_ASSERT
(
0
==
spdylay_stream_add_pushed_stream
(
&
stream
,
i
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment