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
bded1d11
Commit
bded1d11
authored
Nov 22, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
h2load: Support ALPN
parent
fa4f0352
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
20 deletions
+39
-20
src/h2load.cc
src/h2load.cc
+39
-20
No files found.
src/h2load.cc
View file @
bded1d11
...
@@ -462,32 +462,41 @@ void eventcb(bufferevent *bev, short events, void *ptr)
...
@@ -462,32 +462,41 @@ void eventcb(bufferevent *bev, short events, void *ptr)
unsigned
int
next_proto_len
;
unsigned
int
next_proto_len
;
SSL_get0_next_proto_negotiated
(
client
->
ssl
,
SSL_get0_next_proto_negotiated
(
client
->
ssl
,
&
next_proto
,
&
next_proto_len
);
&
next_proto
,
&
next_proto_len
);
for
(
int
i
=
0
;
i
<
2
;
++
i
)
{
if
(
next_proto
)
{
if
(
util
::
check_h2_is_selected
(
next_proto
,
next_proto_len
))
{
client
->
session
=
util
::
make_unique
<
Http2Session
>
(
client
);
}
else
{
#ifdef HAVE_SPDYLAY
auto
spdy_version
=
spdylay_npn_get_version
(
next_proto
,
next_proto_len
);
if
(
spdy_version
)
{
client
->
session
=
util
::
make_unique
<
SpdySession
>
(
client
,
spdy_version
);
}
else
{
debug_nextproto_error
();
client
->
fail
();
return
;
}
#else // !HAVE_SPDYLAY
debug_nextproto_error
();
client
->
fail
();
return
;
#endif // !HAVE_SPDYLAY
}
}
if
(
!
next_proto
)
{
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
debug_nextproto_error
();
SSL_get0_alpn_selected
(
client
->
ssl
,
&
next_proto
,
&
next_proto_len
);
client
->
fail
();
#else // OPENSSL_VERSION_NUMBER < 0x10002000L
return
;
break
;
#endif // OPENSSL_VERSION_NUMBER < 0x10002000L
}
}
if
(
util
::
check_h2_is_selected
(
next_proto
,
next_proto_len
))
{
if
(
!
next_proto
)
{
client
->
session
=
util
::
make_unique
<
Http2Session
>
(
client
);
}
else
{
#ifdef HAVE_SPDYLAY
auto
spdy_version
=
spdylay_npn_get_version
(
next_proto
,
next_proto_len
);
if
(
spdy_version
)
{
client
->
session
=
util
::
make_unique
<
SpdySession
>
(
client
,
spdy_version
);
}
else
{
debug_nextproto_error
();
client
->
fail
();
return
;
}
#else // !HAVE_SPDYLAY
debug_nextproto_error
();
debug_nextproto_error
();
client
->
fail
();
client
->
fail
();
return
;
return
;
#endif // !HAVE_SPDYLAY
}
}
}
else
{
}
else
{
switch
(
config
.
no_tls_proto
)
{
switch
(
config
.
no_tls_proto
)
{
...
@@ -974,6 +983,16 @@ int main(int argc, char **argv)
...
@@ -974,6 +983,16 @@ int main(int argc, char **argv)
SSL_CTX_set_next_proto_select_cb
(
ssl_ctx
,
SSL_CTX_set_next_proto_select_cb
(
ssl_ctx
,
client_select_next_proto_cb
,
nullptr
);
client_select_next_proto_cb
,
nullptr
);
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
auto
proto_list
=
util
::
get_default_alpn
();
#ifdef HAVE_SPDYLAY
static
const
char
spdy_proto_list
[]
=
"\x8spdy/3.1\x6spdy/3\x6spdy/2"
;
std
::
copy
(
spdy_proto_list
,
spdy_proto_list
+
sizeof
(
spdy_proto_list
)
-
1
,
std
::
back_inserter
(
proto_list
));
#endif // HAVE_SPDYLAY
SSL_CTX_set_alpn_protos
(
ssl_ctx
,
proto_list
.
data
(),
proto_list
.
size
());
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
std
::
vector
<
std
::
string
>
reqlines
;
std
::
vector
<
std
::
string
>
reqlines
;
if
(
config
.
ifile
.
empty
())
{
if
(
config
.
ifile
.
empty
())
{
...
...
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