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
6f967c6e
Commit
6f967c6e
authored
Sep 21, 2019
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix errors reported by coverity scan
parent
b8a43db8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
55 deletions
+51
-55
src/HttpServer.cc
src/HttpServer.cc
+43
-50
src/shrpx_config.h
src/shrpx_config.h
+2
-1
src/shrpx_connection.cc
src/shrpx_connection.cc
+3
-3
src/shrpx_http2_session.cc
src/shrpx_http2_session.cc
+1
-0
src/shrpx_worker.h
src/shrpx_worker.h
+2
-1
No files found.
src/HttpServer.cc
View file @
6f967c6e
...
...
@@ -624,33 +624,30 @@ int Http2Handler::read_clear() {
int
rv
;
std
::
array
<
uint8_t
,
8
_k
>
buf
;
for
(;;)
{
ssize_t
nread
;
while
((
nread
=
read
(
fd_
,
buf
.
data
(),
buf
.
size
()))
==
-
1
&&
errno
==
EINTR
)
;
if
(
nread
==
-
1
)
{
if
(
errno
==
EAGAIN
||
errno
==
EWOULDBLOCK
)
{
break
;
}
return
-
1
;
}
if
(
nread
==
0
)
{
return
-
1
;
ssize_t
nread
;
while
((
nread
=
read
(
fd_
,
buf
.
data
(),
buf
.
size
()))
==
-
1
&&
errno
==
EINTR
)
;
if
(
nread
==
-
1
)
{
if
(
errno
==
EAGAIN
||
errno
==
EWOULDBLOCK
)
{
return
write_
(
*
this
);
}
return
-
1
;
}
if
(
nread
==
0
)
{
return
-
1
;
}
if
(
get_config
()
->
hexdump
)
{
util
::
hexdump
(
stdout
,
buf
.
data
(),
nread
);
}
if
(
get_config
()
->
hexdump
)
{
util
::
hexdump
(
stdout
,
buf
.
data
(),
nread
);
}
rv
=
nghttp2_session_mem_recv
(
session_
,
buf
.
data
(),
nread
);
if
(
rv
<
0
)
{
if
(
rv
!=
NGHTTP2_ERR_BAD_CLIENT_MAGIC
)
{
std
::
cerr
<<
"nghttp2_session_mem_recv() returned error: "
<<
nghttp2_strerror
(
rv
)
<<
std
::
endl
;
}
return
-
1
;
rv
=
nghttp2_session_mem_recv
(
session_
,
buf
.
data
(),
nread
);
if
(
rv
<
0
)
{
if
(
rv
!=
NGHTTP2_ERR_BAD_CLIENT_MAGIC
)
{
std
::
cerr
<<
"nghttp2_session_mem_recv() returned error: "
<<
nghttp2_strerror
(
rv
)
<<
std
::
endl
;
}
break
;
return
-
1
;
}
return
write_
(
*
this
);
...
...
@@ -746,40 +743,36 @@ int Http2Handler::read_tls() {
ERR_clear_error
();
for
(;;)
{
auto
rv
=
SSL_read
(
ssl_
,
buf
.
data
(),
buf
.
size
());
if
(
rv
<=
0
)
{
auto
err
=
SSL_get_error
(
ssl_
,
rv
);
switch
(
err
)
{
case
SSL_ERROR_WANT_READ
:
goto
fin
;
case
SSL_ERROR_WANT_WRITE
:
// renegotiation started
return
-
1
;
default:
return
-
1
;
}
auto
rv
=
SSL_read
(
ssl_
,
buf
.
data
(),
buf
.
size
());
if
(
rv
<=
0
)
{
auto
err
=
SSL_get_error
(
ssl_
,
rv
);
switch
(
err
)
{
case
SSL_ERROR_WANT_READ
:
return
write_
(
*
this
);
case
SSL_ERROR_WANT_WRITE
:
// renegotiation started
return
-
1
;
default:
return
-
1
;
}
}
auto
nread
=
rv
;
auto
nread
=
rv
;
if
(
get_config
()
->
hexdump
)
{
util
::
hexdump
(
stdout
,
buf
.
data
(),
nread
);
}
if
(
get_config
()
->
hexdump
)
{
util
::
hexdump
(
stdout
,
buf
.
data
(),
nread
);
}
rv
=
nghttp2_session_mem_recv
(
session_
,
buf
.
data
(),
nread
);
if
(
rv
<
0
)
{
if
(
rv
!=
NGHTTP2_ERR_BAD_CLIENT_MAGIC
)
{
std
::
cerr
<<
"nghttp2_session_mem_recv() returned error: "
<<
nghttp2_strerror
(
rv
)
<<
std
::
endl
;
}
return
-
1
;
rv
=
nghttp2_session_mem_recv
(
session_
,
buf
.
data
(),
nread
);
if
(
rv
<
0
)
{
if
(
rv
!=
NGHTTP2_ERR_BAD_CLIENT_MAGIC
)
{
std
::
cerr
<<
"nghttp2_session_mem_recv() returned error: "
<<
nghttp2_strerror
(
rv
)
<<
std
::
endl
;
}
break
;
return
-
1
;
}
fin:
return
write_
(
*
this
);
}
...
...
src/shrpx_config.h
View file @
6f967c6e
...
...
@@ -505,7 +505,8 @@ struct DownstreamAddrGroupConfig {
DownstreamAddrGroupConfig
(
const
StringRef
&
pattern
)
:
pattern
(
pattern
),
affinity
{
SessionAffinity
::
NONE
},
redirect_if_not_tls
(
false
)
{}
redirect_if_not_tls
(
false
),
timeout
{}
{}
StringRef
pattern
;
StringRef
mruby_file
;
...
...
src/shrpx_connection.cc
View file @
6f967c6e
...
...
@@ -469,9 +469,9 @@ int Connection::tls_handshake() {
<<
ERR_error_string
(
ERR_get_error
(),
nullptr
);
}
struct
iovec
iov
;
auto
iovcnt
=
tls
.
wbuf
.
riovec
(
&
iov
,
1
);
auto
nwrite
=
writev_clear
(
&
iov
,
iovcnt
);
struct
iovec
iov
[
1
]
;
auto
iovcnt
=
tls
.
wbuf
.
riovec
(
iov
,
1
);
auto
nwrite
=
writev_clear
(
iov
,
iovcnt
);
if
(
nwrite
>
0
)
{
tls
.
wbuf
.
drain
(
nwrite
);
}
...
...
src/shrpx_http2_session.cc
View file @
6f967c6e
...
...
@@ -1097,6 +1097,7 @@ int on_response_headers(Http2Session *http2session, Downstream *downstream,
auto
status
=
resp
.
fs
.
header
(
http2
::
HD__STATUS
);
// libnghttp2 guarantees this exists and can be parsed
assert
(
status
);
auto
status_code
=
http2
::
parse_http_status_code
(
status
->
value
);
resp
.
http_status
=
status_code
;
...
...
src/shrpx_worker.h
View file @
6f967c6e
...
...
@@ -190,7 +190,8 @@ struct SharedDownstreamAddr {
SharedDownstreamAddr
()
:
balloc
(
1024
,
1024
),
affinity
{
SessionAffinity
::
NONE
},
redirect_if_not_tls
{
false
}
{}
redirect_if_not_tls
{
false
},
timeout
{}
{}
SharedDownstreamAddr
(
const
SharedDownstreamAddr
&
)
=
delete
;
SharedDownstreamAddr
(
SharedDownstreamAddr
&&
)
=
delete
;
...
...
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