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
ecc4290d
Commit
ecc4290d
authored
Jan 08, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttp: Fix crash on plain HTTP
parent
0fb4d32d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
26 deletions
+28
-26
src/nghttp.cc
src/nghttp.cc
+28
-26
No files found.
src/nghttp.cc
View file @
ecc4290d
...
...
@@ -1313,36 +1313,38 @@ void eventcb(bufferevent *bev, short events, void *ptr)
if
(
client
->
need_upgrade
())
{
rv
=
client
->
on_upgrade_connect
();
}
else
{
// Check NPN or ALPN result
const
unsigned
char
*
next_proto
=
nullptr
;
unsigned
int
next_proto_len
;
SSL_get0_next_proto_negotiated
(
client
->
ssl
,
&
next_proto
,
&
next_proto_len
);
for
(
int
i
=
0
;
i
<
2
;
++
i
)
{
if
(
next_proto
)
{
if
(
config
.
verbose
)
{
std
::
cout
<<
"The negotiated protocol: "
;
std
::
cout
.
write
(
reinterpret_cast
<
const
char
*>
(
next_proto
),
next_proto_len
);
std
::
cout
<<
std
::
endl
;
}
if
(
NGHTTP2_PROTO_VERSION_ID_LEN
!=
next_proto_len
||
memcmp
(
NGHTTP2_PROTO_VERSION_ID
,
next_proto
,
NGHTTP2_PROTO_VERSION_ID_LEN
)
!=
0
)
{
next_proto
=
nullptr
;
if
(
client
->
ssl
)
{
// Check NPN or ALPN result
const
unsigned
char
*
next_proto
=
nullptr
;
unsigned
int
next_proto_len
;
SSL_get0_next_proto_negotiated
(
client
->
ssl
,
&
next_proto
,
&
next_proto_len
);
for
(
int
i
=
0
;
i
<
2
;
++
i
)
{
if
(
next_proto
)
{
if
(
config
.
verbose
)
{
std
::
cout
<<
"The negotiated protocol: "
;
std
::
cout
.
write
(
reinterpret_cast
<
const
char
*>
(
next_proto
),
next_proto_len
);
std
::
cout
<<
std
::
endl
;
}
if
(
NGHTTP2_PROTO_VERSION_ID_LEN
!=
next_proto_len
||
memcmp
(
NGHTTP2_PROTO_VERSION_ID
,
next_proto
,
NGHTTP2_PROTO_VERSION_ID_LEN
)
!=
0
)
{
next_proto
=
nullptr
;
}
break
;
}
break
;
}
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
SSL_get0_alpn_selected
(
client
->
ssl
,
&
next_proto
,
&
next_proto_len
);
SSL_get0_alpn_selected
(
client
->
ssl
,
&
next_proto
,
&
next_proto_len
);
#else // OPENSSL_VERSION_NUMBER < 0x10002000L
break
;
break
;
#endif // OPENSSL_VERSION_NUMBER < 0x10002000L
}
if
(
!
next_proto
)
{
print_protocol_nego_error
();
client
->
disconnect
();
return
;
}
if
(
!
next_proto
)
{
print_protocol_nego_error
();
client
->
disconnect
();
return
;
}
}
rv
=
client
->
on_connect
();
}
...
...
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