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
e2906025
Commit
e2906025
authored
Jul 31, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Don't exit from save_pid and set_alpn_prefs
parent
9a8e9815
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
16 deletions
+18
-16
src/shrpx.cc
src/shrpx.cc
+10
-6
src/shrpx_ssl.cc
src/shrpx_ssl.cc
+6
-8
src/shrpx_ssl.h
src/shrpx_ssl.h
+2
-2
No files found.
src/shrpx.cc
View file @
e2906025
...
...
@@ -294,7 +294,7 @@ int chown_to_running_user(const char *path) {
}
// namespace
namespace
{
void
save_pid
()
{
int
save_pid
()
{
constexpr
auto
SUFFIX
=
StringRef
::
from_lit
(
".XXXXXX"
);
auto
&
pid_file
=
get_config
()
->
pid_file
;
...
...
@@ -313,7 +313,7 @@ void save_pid() {
auto
error
=
errno
;
LOG
(
ERROR
)
<<
"Could not save PID to file "
<<
pid_file
<<
": "
<<
strerror
(
error
);
exit
(
EXIT_FAILURE
)
;
return
-
1
;
}
auto
content
=
util
::
utos
(
get_config
()
->
pid
)
+
'\n'
;
...
...
@@ -322,14 +322,14 @@ void save_pid() {
auto
error
=
errno
;
LOG
(
ERROR
)
<<
"Could not save PID to file "
<<
pid_file
<<
": "
<<
strerror
(
error
);
exit
(
EXIT_FAILURE
)
;
return
-
1
;
}
if
(
fsync
(
fd
)
==
-
1
)
{
auto
error
=
errno
;
LOG
(
ERROR
)
<<
"Could not save PID to file "
<<
pid_file
<<
": "
<<
strerror
(
error
);
exit
(
EXIT_FAILURE
)
;
return
-
1
;
}
close
(
fd
);
...
...
@@ -341,7 +341,7 @@ void save_pid() {
unlink
(
temp_path
);
exit
(
EXIT_FAILURE
)
;
return
-
1
;
}
if
(
get_config
()
->
uid
!=
0
)
{
...
...
@@ -351,6 +351,8 @@ void save_pid() {
<<
" failed: "
<<
strerror
(
error
);
}
}
return
0
;
}
}
// namespace
...
...
@@ -2379,7 +2381,9 @@ int process_options(Config *config,
tlsconf
.
tls_proto_mask
=
ssl
::
create_tls_proto_mask
(
tlsconf
.
tls_proto_list
);
tlsconf
.
alpn_prefs
=
ssl
::
set_alpn_prefs
(
tlsconf
.
npn_list
);
if
(
ssl
::
set_alpn_prefs
(
tlsconf
.
alpn_prefs
,
tlsconf
.
npn_list
)
!=
0
)
{
return
-
1
;
}
tlsconf
.
bio_method
=
create_bio_method
();
...
...
src/shrpx_ssl.cc
View file @
e2906025
...
...
@@ -94,16 +94,14 @@ int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) {
}
}
// namespace
// This function is meant be called from master process, hence the
// call exit(3).
std
::
vector
<
unsigned
char
>
set_alpn_prefs
(
const
std
::
vector
<
std
::
string
>
&
protos
)
{
int
set_alpn_prefs
(
std
::
vector
<
unsigned
char
>
&
out
,
const
std
::
vector
<
std
::
string
>
&
protos
)
{
size_t
len
=
0
;
for
(
const
auto
&
proto
:
protos
)
{
if
(
proto
.
size
()
>
255
)
{
LOG
(
FATAL
)
<<
"Too long ALPN identifier: "
<<
proto
.
size
();
exit
(
EXIT_FAILURE
)
;
return
-
1
;
}
len
+=
1
+
proto
.
size
();
...
...
@@ -111,10 +109,10 @@ set_alpn_prefs(const std::vector<std::string> &protos) {
if
(
len
>
(
1
<<
16
)
-
1
)
{
LOG
(
FATAL
)
<<
"Too long ALPN identifier list: "
<<
len
;
exit
(
EXIT_FAILURE
)
;
return
-
1
;
}
auto
out
=
std
::
vector
<
unsigned
char
>
(
len
);
out
.
resize
(
len
);
auto
ptr
=
out
.
data
();
for
(
const
auto
&
proto
:
protos
)
{
...
...
@@ -123,7 +121,7 @@ set_alpn_prefs(const std::vector<std::string> &protos) {
ptr
+=
proto
.
size
();
}
return
out
;
return
0
;
}
namespace
{
...
...
src/shrpx_ssl.h
View file @
e2906025
...
...
@@ -181,8 +181,8 @@ bool check_http2_requirement(SSL *ssl);
// passed to SSL_CTX_set_options().
long
int
create_tls_proto_mask
(
const
std
::
vector
<
std
::
string
>
&
tls_proto_list
);
std
::
vector
<
unsigned
char
>
set_alpn_prefs
(
const
std
::
vector
<
std
::
string
>
&
protos
);
int
set_alpn_prefs
(
std
::
vector
<
unsigned
char
>
&
out
,
const
std
::
vector
<
std
::
string
>
&
protos
);
// Setups server side SSL_CTX. This function inspects get_config()
// and if upstream_no_tls is true, returns nullptr. Otherwise
...
...
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