Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
We have upgraded GitLab to 15.1. Due to major code changes GitLab was down for some time.
Open sidebar
dcdb
dcdb
Commits
13b9b5cb
Commit
13b9b5cb
authored
May 05, 2020
by
Michael Ott
Browse files
Reduce verbosity of HTTPS handshake errors
parent
e4383ac8
Changes
1
Hide whitespace changes
Inline
Side-by-side
common/src/RESTHttpsServer.cpp
View file @
13b9b5cb
...
...
@@ -113,7 +113,7 @@ RESTHttpsServer::RESTHttpsServer(serverSettings_t settings) :
void
RESTHttpsServer
::
handle_session
(
tcp
::
socket
&
socket
,
ssl
::
context
&
ctx
)
{
ServerLOG
(
info
)
<<
_remoteEndpoint
.
address
().
to_string
()
<<
":"
ServerLOG
(
debug
)
<<
_remoteEndpoint
.
address
().
to_string
()
<<
":"
<<
_remoteEndpoint
.
port
()
<<
" connecting"
;
bool
close
=
false
;
...
...
@@ -125,7 +125,7 @@ void RESTHttpsServer::handle_session(tcp::socket& socket, ssl::context& ctx) {
// Perform the SSL handshake
stream
.
handshake
(
ssl
::
stream_base
::
server
,
ec
);
if
(
ec
)
{
ServerLOG
(
error
)
<<
"handshake: "
<<
ec
.
message
();
ServerLOG
(
debug
)
<<
"handshake
error
: "
<<
ec
.
message
();
goto
serverError
;
}
...
...
@@ -145,7 +145,7 @@ void RESTHttpsServer::handle_session(tcp::socket& socket, ssl::context& ctx) {
break
;
}
if
(
ec
)
{
ServerLOG
(
error
)
<<
"read: "
<<
ec
.
message
();
ServerLOG
(
debug
)
<<
"read
error
: "
<<
ec
.
message
();
goto
serverError
;
}
...
...
@@ -157,7 +157,7 @@ void RESTHttpsServer::handle_session(tcp::socket& socket, ssl::context& ctx) {
handle_request
(
req
,
lambda
);
if
(
ec
)
{
ServerLOG
(
error
)
<<
"write: "
<<
ec
.
message
();
ServerLOG
(
debug
)
<<
"write
error
: "
<<
ec
.
message
();
goto
serverError
;
}
if
(
close
)
{
...
...
@@ -170,7 +170,7 @@ void RESTHttpsServer::handle_session(tcp::socket& socket, ssl::context& ctx) {
// Perform the SSL shutdown
stream
.
shutdown
(
ec
);
if
(
ec
)
{
ServerLOG
(
error
)
<<
"stream shutdown: "
<<
ec
.
message
();
}
if
(
ec
)
{
ServerLOG
(
debug
)
<<
"stream shutdown
error
: "
<<
ec
.
message
();
}
serverError:
//For graceful closure of a connected socket we shut it down first although
...
...
@@ -180,7 +180,7 @@ serverError:
if
(
ec
)
{
ServerLOG
(
debug
)
<<
"socket shutdown: "
<<
ec
.
message
();
}
socket
.
close
(
ec
);
if
(
ec
)
{
ServerLOG
(
error
)
<<
"socket close: "
<<
ec
.
message
();
}
if
(
ec
)
{
ServerLOG
(
debug
)
<<
"socket close
error
: "
<<
ec
.
message
();
}
startAccept
();
}
...
...
@@ -203,17 +203,17 @@ void RESTHttpsServer::handle_request(http::request<Body>& req, Send&& send) {
if
(
endpoint
.
first
==
req
.
method
())
{
//Everything matches --> call the endpoint function
ServerLOG
(
info
)
<<
req
.
method_string
()
<<
" "
<<
endpointName
<<
" requested"
;
ServerLOG
(
debug
)
<<
req
.
method_string
()
<<
" "
<<
endpointName
<<
" requested"
;
endpoint
.
second
(
req
,
res
,
queries
);
}
else
{
const
std
::
string
msg
=
"Request method "
+
req
.
method_string
().
to_string
()
+
" does not match endpoint "
+
endpointName
+
"
\n
"
;
ServerLOG
(
info
)
<<
msg
;
ServerLOG
(
debug
)
<<
msg
;
res
.
result
(
http
::
status
::
bad_request
);
res
.
body
()
=
msg
;
}
}
catch
(
const
std
::
out_of_range
&
e
)
{
ServerLOG
(
info
)
<<
"Requested endpoint "
<<
endpointName
<<
" not found"
;
ServerLOG
(
debug
)
<<
"Requested endpoint "
<<
endpointName
<<
" not found"
;
res
.
result
(
http
::
status
::
not_implemented
);
res
.
body
()
=
"Invalid endpoint
\n
"
;
}
...
...
@@ -331,7 +331,7 @@ bool RESTHttpsServer::validateUser(const http::request<Body>& req, Send&& send)
return
false
;
}
}
catch
(
const
std
::
out_of_range
&
e
)
{
ServerLOG
(
error
)
<<
"Permission out of range (method not supported)"
;
ServerLOG
(
debug
)
<<
"Permission out of range (method not supported)"
;
res
.
result
(
http
::
status
::
not_implemented
);
res
.
body
()
=
"Request method not supported!
\n
"
;
res
.
prepare_payload
();
...
...
@@ -347,7 +347,7 @@ std::string RESTHttpsServer::splitUri(const std::string& uri, queries_t& queries
std
::
string
path
;
std
::
string
query
;
ServerLOG
(
debug
)
<<
"Splitting URI "
<<
uri
;
//
ServerLOG(debug) << "Splitting URI " << uri;
size_t
pos
=
uri
.
find
(
'?'
);
path
=
uri
.
substr
(
0
,
pos
);
...
...
Write
Preview
Supports
Markdown
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