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
8fac2592
Commit
8fac2592
authored
Feb 09, 2012
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
For non-overlap case, made out and outlen left untouched
parent
f1c44273
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
25 deletions
+10
-25
lib/includes/spdylay/spdylay.h
lib/includes/spdylay/spdylay.h
+6
-18
lib/spdylay_npn.c
lib/spdylay_npn.c
+0
-3
tests/spdylay_npn_test.c
tests/spdylay_npn_test.c
+4
-4
No files found.
lib/includes/spdylay/spdylay.h
View file @
8fac2592
...
@@ -489,32 +489,20 @@ int spdylay_submit_goaway(spdylay_session *session);
...
@@ -489,32 +489,20 @@ int spdylay_submit_goaway(spdylay_session *session);
* 2. If server's list contains "http/1.1", this function selects
* 2. If server's list contains "http/1.1", this function selects
* "http/1.1" and returns 0. The following step is not taken.
* "http/1.1" and returns 0. The following step is not taken.
*
*
* 3. This function selects "spdy/2" and returns -1. (So called
* 3. This function selects nothing and returns -1. (So called
* non-overlap case).
* non-overlap case). In this case, |out| and |outlen| are left
* untouched.
*
*
* When spdylay supports updated version of SPDY in the future, this
* When spdylay supports updated version of SPDY in the future, this
* function may select updated protocol and application code which
* function may select updated protocol and application code which
* relies on spdylay for SPDY stuff needs not be modified.
* relies on spdylay for SPDY stuff needs not be modified.
*
*
* For rationale of step 3, NPN draft permits that client can select
* any protocol even if server does not advertise it at the time of
* this writing:
*
* It's expected that a client will have a list of protocols that it
* supports, in preference order, and will only select a protocol if
* the server supports it. In that case, the client SHOULD select
* the first protocol advertised by the server that it also
* supports. In the event that the client doesn't support any of
* server's protocols, or the server doesn't advertise any, it
* SHOULD select the first protocol that it supports.
*
* There are cases where the client knows that a server supports an
* unadvertised protocol. In these cases the client should simply
* select that protocol.
*
* Selecting "spdy/2" means that "spdy/2" is written into |*out| and
* Selecting "spdy/2" means that "spdy/2" is written into |*out| and
* length of "spdy/2" (which is 6) is assigned to |*outlen|.
* length of "spdy/2" (which is 6) is assigned to |*outlen|.
*
*
* See http://technotes.googlecode.com/git/nextprotoneg.html for more
* details about NPN.
*
* To use this method you should do something like:
* To use this method you should do something like:
*
*
* static int select_next_proto_cb(SSL* ssl,
* static int select_next_proto_cb(SSL* ssl,
...
...
lib/spdylay_npn.c
View file @
8fac2592
...
@@ -31,9 +31,6 @@ int spdylay_select_next_protocol(unsigned char **out, unsigned char *outlen,
...
@@ -31,9 +31,6 @@ int spdylay_select_next_protocol(unsigned char **out, unsigned char *outlen,
{
{
int
http_selected
=
0
;
int
http_selected
=
0
;
unsigned
int
i
=
0
;
unsigned
int
i
=
0
;
/* For non-overlap case */
*
out
=
(
unsigned
char
*
)
"spdy/2"
;
*
outlen
=
6
;
for
(;
i
<
inlen
;
i
+=
in
[
i
]
+
1
)
{
for
(;
i
<
inlen
;
i
+=
in
[
i
]
+
1
)
{
if
(
in
[
i
]
==
6
&&
memcmp
(
&
in
[
i
+
1
],
"spdy/2"
,
in
[
i
])
==
0
)
{
if
(
in
[
i
]
==
6
&&
memcmp
(
&
in
[
i
+
1
],
"spdy/2"
,
in
[
i
])
==
0
)
{
*
out
=
(
unsigned
char
*
)
&
in
[
i
+
1
];
*
out
=
(
unsigned
char
*
)
&
in
[
i
+
1
];
...
...
tests/spdylay_npn_test.c
View file @
8fac2592
...
@@ -64,12 +64,12 @@ static void no_overlap()
...
@@ -64,12 +64,12 @@ static void no_overlap()
8
,
's'
,
'p'
,
'd'
,
'y'
,
'/'
,
'2'
,
'.'
,
'1'
,
8
,
's'
,
'p'
,
'd'
,
'y'
,
'/'
,
'2'
,
'.'
,
'1'
,
8
,
'h'
,
't'
,
't'
,
'p'
,
'/'
,
'1'
,
'.'
,
'0'
,
8
,
'h'
,
't'
,
't'
,
'p'
,
'/'
,
'1'
,
'.'
,
'0'
,
};
};
unsigned
char
outlen
;
unsigned
char
outlen
=
0
;
unsigned
char
*
out
;
unsigned
char
*
out
=
NULL
;
CU_ASSERT
(
-
1
==
spdylay_select_next_protocol
(
&
out
,
&
outlen
,
CU_ASSERT
(
-
1
==
spdylay_select_next_protocol
(
&
out
,
&
outlen
,
spdy
,
sizeof
(
spdy
)));
spdy
,
sizeof
(
spdy
)));
CU_ASSERT
(
6
==
outlen
);
CU_ASSERT
(
0
==
outlen
);
CU_ASSERT
(
memcmp
(
"spdy/2"
,
out
,
outlen
)
==
0
);
CU_ASSERT
(
NULL
==
out
);
}
}
void
test_spdylay_npn
()
void
test_spdylay_npn
()
...
...
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