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
3931a0b0
Commit
3931a0b0
authored
Oct 10, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bugs found by coverity scan
parent
70c05584
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
6 deletions
+28
-6
examples/tiny-nghttpd.c
examples/tiny-nghttpd.c
+16
-4
src/HttpServer.cc
src/HttpServer.cc
+11
-2
src/HttpServer.h
src/HttpServer.h
+1
-0
No files found.
examples/tiny-nghttpd.c
View file @
3931a0b0
...
...
@@ -422,7 +422,11 @@ static int server_init(server *serv, const char *node, const char *service)
continue
;
}
setsockopt
(
fd
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
on
,
optlen
);
rv
=
setsockopt
(
fd
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
on
,
optlen
);
if
(
rv
==
-
1
)
{
print_errno
(
"setsockopt"
,
errno
);
}
if
(
bind
(
fd
,
rp
->
ai_addr
,
rp
->
ai_addrlen
)
!=
0
)
{
close
(
fd
);
...
...
@@ -552,7 +556,10 @@ static int handle_timer(io_loop *loop, uint32_t events, void *ptr)
ssize_t
nread
;
while
((
nread
=
read
(
tmr
->
fd
,
buf
,
sizeof
(
buf
)))
==
-
1
&&
errno
==
EINTR
);
break
;
if
(
nread
==
-
1
)
{
break
;
}
}
update_date
();
...
...
@@ -566,6 +573,7 @@ static int handle_accept(io_loop *loop, uint32_t events, void *ptr)
server
*
serv
=
ptr
;
int
on
=
1
;
socklen_t
optlen
=
sizeof
(
on
);
int
rv
;
for
(;;)
{
connection
*
conn
;
...
...
@@ -574,7 +582,7 @@ static int handle_accept(io_loop *loop, uint32_t events, void *ptr)
errno
==
EINTR
);
if
(
acfd
==
-
1
)
{
switch
(
acfd
)
{
switch
(
errno
)
{
case
ENETDOWN
:
case
EPROTO
:
case
ENOPROTOOPT
:
...
...
@@ -588,7 +596,11 @@ static int handle_accept(io_loop *loop, uint32_t events, void *ptr)
return
0
;
}
setsockopt
(
acfd
,
IPPROTO_TCP
,
TCP_NODELAY
,
&
on
,
optlen
);
rv
=
setsockopt
(
acfd
,
IPPROTO_TCP
,
TCP_NODELAY
,
&
on
,
optlen
);
if
(
rv
==
-
1
)
{
print_errno
(
"setsockopt"
,
errno
);
}
conn
=
connection_new
(
acfd
);
...
...
src/HttpServer.cc
View file @
3931a0b0
...
...
@@ -122,6 +122,11 @@ Config::Config()
nghttp2_option_set_recv_client_preface
(
session_option
,
1
);
}
Config
::~
Config
()
{
nghttp2_option_del
(
session_option
);
}
Stream
::
Stream
(
Http2Handler
*
handler
,
int32_t
stream_id
)
:
handler
(
handler
),
rtimer
(
nullptr
),
...
...
@@ -512,7 +517,9 @@ int Http2Handler::on_read()
return
-
1
;
}
evbuffer_drain
(
input
,
len
);
if
(
evbuffer_drain
(
input
,
len
)
==
-
1
)
{
std
::
cerr
<<
"evbuffer_drain() failed"
<<
std
::
endl
;
}
}
return
send
();
...
...
@@ -1268,7 +1275,9 @@ void worker_readcb(bufferevent *bev, void *arg)
auto
input
=
bufferevent_get_input
(
bev
);
while
(
evbuffer_get_length
(
input
)
>=
sizeof
(
ClientInfo
))
{
ClientInfo
client
;
evbuffer_remove
(
input
,
&
client
,
sizeof
(
client
));
if
(
evbuffer_remove
(
input
,
&
client
,
sizeof
(
client
))
==
-
1
)
{
std
::
cerr
<<
"evbuffer_remove() failed"
<<
std
::
endl
;
}
sessions
->
accept_connection
(
client
.
fd
);
}
}
...
...
src/HttpServer.h
View file @
3931a0b0
...
...
@@ -80,6 +80,7 @@ struct Config {
bool
error_gzip
;
bool
early_response
;
Config
();
~
Config
();
};
class
Http2Handler
;
...
...
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