Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
72d3fecc
Commit
72d3fecc
authored
Jun 15, 2018
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better logging for SSL debugging
parent
df6e7ca8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
15 deletions
+34
-15
QGCLoggingCategory.cc
src/QGCLoggingCategory.cc
+0
-2
TerrainQuery.cc
src/Terrain/TerrainQuery.cc
+32
-12
TerrainQuery.h
src/Terrain/TerrainQuery.h
+2
-1
No files found.
src/QGCLoggingCategory.cc
View file @
72d3fecc
...
@@ -66,8 +66,6 @@ void QGCLoggingCategoryRegister::setFilterRulesFromSettings(const QString& comma
...
@@ -66,8 +66,6 @@ void QGCLoggingCategoryRegister::setFilterRulesFromSettings(const QString& comma
}
}
QString
filterRules
;
QString
filterRules
;
// Turn off bogus ssl warning
filterRules
+=
"qt.network.ssl.warning=false
\n
"
;
filterRules
+=
"*Log.debug=false
\n
"
;
filterRules
+=
"*Log.debug=false
\n
"
;
// Set up filters defined in settings
// Set up filters defined in settings
...
...
src/Terrain/TerrainQuery.cc
View file @
72d3fecc
...
@@ -17,11 +17,13 @@
...
@@ -17,11 +17,13 @@
#include <QNetworkRequest>
#include <QNetworkRequest>
#include <QNetworkProxy>
#include <QNetworkProxy>
#include <QNetworkReply>
#include <QNetworkReply>
#include <QSslConfiguration>
#include <QJsonDocument>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonArray>
#include <QTimer>
#include <QTimer>
#include <QtLocation/private/qgeotilespec_p.h>
#include <QtLocation/private/qgeotilespec_p.h>
#include <cmath>
#include <cmath>
QGC_LOGGING_CATEGORY
(
TerrainQueryLog
,
"TerrainQueryLog"
)
QGC_LOGGING_CATEGORY
(
TerrainQueryLog
,
"TerrainQueryLog"
)
...
@@ -33,7 +35,7 @@ Q_GLOBAL_STATIC(TerrainTileManager, _terrainTileManager)
...
@@ -33,7 +35,7 @@ Q_GLOBAL_STATIC(TerrainTileManager, _terrainTileManager)
TerrainAirMapQuery
::
TerrainAirMapQuery
(
QObject
*
parent
)
TerrainAirMapQuery
::
TerrainAirMapQuery
(
QObject
*
parent
)
:
TerrainQueryInterface
(
parent
)
:
TerrainQueryInterface
(
parent
)
{
{
qCDebug
(
TerrainQueryVerboseLog
)
<<
"supportsSsl"
<<
QSslSocket
::
supportsSsl
()
<<
"sslLibraryBuildVersionString"
<<
QSslSocket
::
sslLibraryBuildVersionString
();
}
}
void
TerrainAirMapQuery
::
requestCoordinateHeights
(
const
QList
<
QGeoCoordinate
>&
coordinates
)
void
TerrainAirMapQuery
::
requestCoordinateHeights
(
const
QList
<
QGeoCoordinate
>&
coordinates
)
...
@@ -107,18 +109,24 @@ void TerrainAirMapQuery::_sendQuery(const QString& path, const QUrlQuery& urlQue
...
@@ -107,18 +109,24 @@ void TerrainAirMapQuery::_sendQuery(const QString& path, const QUrlQuery& urlQue
QNetworkRequest
request
(
url
);
QNetworkRequest
request
(
url
);
QSslConfiguration
sslConf
=
request
.
sslConfiguration
();
sslConf
.
setPeerVerifyMode
(
QSslSocket
::
VerifyNone
);
request
.
setSslConfiguration
(
sslConf
);
QNetworkProxy
tProxy
;
QNetworkProxy
tProxy
;
tProxy
.
setType
(
QNetworkProxy
::
DefaultProxy
);
tProxy
.
setType
(
QNetworkProxy
::
DefaultProxy
);
_networkManager
.
setProxy
(
tProxy
);
_networkManager
.
setProxy
(
tProxy
);
QNetworkReply
*
networkReply
=
_networkManager
.
get
(
request
);
QNetworkReply
*
networkReply
=
_networkManager
.
get
(
request
);
if
(
!
networkReply
)
{
if
(
!
networkReply
)
{
qC
Debu
g
(
TerrainQueryLog
)
<<
"QNetworkManager::Get did not return QNetworkReply"
;
qC
Warnin
g
(
TerrainQueryLog
)
<<
"QNetworkManager::Get did not return QNetworkReply"
;
_requestFailed
();
_requestFailed
();
return
;
return
;
}
}
networkReply
->
ignoreSslErrors
();
connect
(
networkReply
,
&
QNetworkReply
::
finished
,
this
,
&
TerrainAirMapQuery
::
_requestFinished
);
connect
(
networkReply
,
&
QNetworkReply
::
finished
,
this
,
&
TerrainAirMapQuery
::
_requestFinished
);
connect
(
networkReply
,
&
QNetworkReply
::
sslErrors
,
this
,
&
TerrainAirMapQuery
::
_sslErrors
);
connect
(
networkReply
,
QOverload
<
QNetworkReply
::
NetworkError
>::
of
(
&
QNetworkReply
::
error
),
this
,
&
TerrainAirMapQuery
::
_requestError
);
connect
(
networkReply
,
QOverload
<
QNetworkReply
::
NetworkError
>::
of
(
&
QNetworkReply
::
error
),
this
,
&
TerrainAirMapQuery
::
_requestError
);
}
}
...
@@ -127,17 +135,29 @@ void TerrainAirMapQuery::_requestError(QNetworkReply::NetworkError code)
...
@@ -127,17 +135,29 @@ void TerrainAirMapQuery::_requestError(QNetworkReply::NetworkError code)
QNetworkReply
*
reply
=
qobject_cast
<
QNetworkReply
*>
(
QObject
::
sender
());
QNetworkReply
*
reply
=
qobject_cast
<
QNetworkReply
*>
(
QObject
::
sender
());
if
(
code
!=
QNetworkReply
::
NoError
)
{
if
(
code
!=
QNetworkReply
::
NoError
)
{
qC
Debu
g
(
TerrainQueryLog
)
<<
"_requestError error:url:data"
<<
reply
->
error
()
<<
reply
->
url
()
<<
reply
->
readAll
();
qC
Warnin
g
(
TerrainQueryLog
)
<<
"_requestError error:url:data"
<<
reply
->
error
()
<<
reply
->
url
()
<<
reply
->
readAll
();
return
;
return
;
}
}
}
}
void
TerrainAirMapQuery
::
_sslErrors
(
const
QList
<
QSslError
>
&
errors
)
{
for
(
const
auto
&
error
:
errors
)
{
qCWarning
(
TerrainQueryLog
)
<<
"SSL error: "
<<
error
.
errorString
();
const
auto
&
certificate
=
error
.
certificate
();
if
(
!
certificate
.
isNull
())
{
qCWarning
(
TerrainQueryLog
)
<<
"SSL Certificate problem: "
<<
certificate
.
toText
();
}
}
}
void
TerrainAirMapQuery
::
_requestFinished
(
void
)
void
TerrainAirMapQuery
::
_requestFinished
(
void
)
{
{
QNetworkReply
*
reply
=
qobject_cast
<
QNetworkReply
*>
(
QObject
::
sender
());
QNetworkReply
*
reply
=
qobject_cast
<
QNetworkReply
*>
(
QObject
::
sender
());
if
(
reply
->
error
()
!=
QNetworkReply
::
NoError
)
{
if
(
reply
->
error
()
!=
QNetworkReply
::
NoError
)
{
qC
Debu
g
(
TerrainQueryLog
)
<<
"_requestFinished error:url:data"
<<
reply
->
error
()
<<
reply
->
url
()
<<
reply
->
readAll
();
qC
Warnin
g
(
TerrainQueryLog
)
<<
"_requestFinished error:url:data"
<<
reply
->
error
()
<<
reply
->
url
()
<<
reply
->
readAll
();
reply
->
deleteLater
();
reply
->
deleteLater
();
_requestFailed
();
_requestFailed
();
return
;
return
;
...
@@ -150,7 +170,7 @@ void TerrainAirMapQuery::_requestFinished(void)
...
@@ -150,7 +170,7 @@ void TerrainAirMapQuery::_requestFinished(void)
QJsonParseError
parseError
;
QJsonParseError
parseError
;
QJsonDocument
responseJson
=
QJsonDocument
::
fromJson
(
responseBytes
,
&
parseError
);
QJsonDocument
responseJson
=
QJsonDocument
::
fromJson
(
responseBytes
,
&
parseError
);
if
(
parseError
.
error
!=
QJsonParseError
::
NoError
)
{
if
(
parseError
.
error
!=
QJsonParseError
::
NoError
)
{
qC
Debu
g
(
TerrainQueryLog
)
<<
"_requestFinished unable to parse json:"
<<
parseError
.
errorString
();
qC
Warnin
g
(
TerrainQueryLog
)
<<
"_requestFinished unable to parse json:"
<<
parseError
.
errorString
();
_requestFailed
();
_requestFailed
();
return
;
return
;
}
}
...
@@ -159,7 +179,7 @@ void TerrainAirMapQuery::_requestFinished(void)
...
@@ -159,7 +179,7 @@ void TerrainAirMapQuery::_requestFinished(void)
QJsonObject
rootObject
=
responseJson
.
object
();
QJsonObject
rootObject
=
responseJson
.
object
();
QString
status
=
rootObject
[
"status"
].
toString
();
QString
status
=
rootObject
[
"status"
].
toString
();
if
(
status
!=
"success"
)
{
if
(
status
!=
"success"
)
{
qC
Debu
g
(
TerrainQueryLog
)
<<
"_requestFinished status != success:"
<<
status
;
qC
Warnin
g
(
TerrainQueryLog
)
<<
"_requestFinished status != success:"
<<
status
;
_requestFailed
();
_requestFailed
();
return
;
return
;
}
}
...
@@ -252,7 +272,7 @@ void TerrainAirMapQuery::_parseCarpetData(const QJsonValue& carpetJson)
...
@@ -252,7 +272,7 @@ void TerrainAirMapQuery::_parseCarpetData(const QJsonValue& carpetJson)
TerrainOfflineAirMapQuery
::
TerrainOfflineAirMapQuery
(
QObject
*
parent
)
TerrainOfflineAirMapQuery
::
TerrainOfflineAirMapQuery
(
QObject
*
parent
)
:
TerrainQueryInterface
(
parent
)
:
TerrainQueryInterface
(
parent
)
{
{
qCDebug
(
TerrainQueryVerboseLog
)
<<
"supportsSsl"
<<
QSslSocket
::
supportsSsl
()
<<
"sslLibraryBuildVersionString"
<<
QSslSocket
::
sslLibraryBuildVersionString
();
}
}
void
TerrainOfflineAirMapQuery
::
requestCoordinateHeights
(
const
QList
<
QGeoCoordinate
>&
coordinates
)
void
TerrainOfflineAirMapQuery
::
requestCoordinateHeights
(
const
QList
<
QGeoCoordinate
>&
coordinates
)
...
@@ -385,7 +405,7 @@ bool TerrainTileManager::_getAltitudesForCoordinates(const QList<QGeoCoordinate>
...
@@ -385,7 +405,7 @@ bool TerrainTileManager::_getAltitudesForCoordinates(const QList<QGeoCoordinate>
if
(
_tiles
[
tileHash
].
isIn
(
coordinate
))
{
if
(
_tiles
[
tileHash
].
isIn
(
coordinate
))
{
altitudes
.
push_back
(
_tiles
[
tileHash
].
elevation
(
coordinate
));
altitudes
.
push_back
(
_tiles
[
tileHash
].
elevation
(
coordinate
));
}
else
{
}
else
{
qC
Debu
g
(
TerrainQueryLog
)
<<
"Error: coordinate not in tile region"
;
qC
Warnin
g
(
TerrainQueryLog
)
<<
"Error: coordinate not in tile region"
;
altitudes
.
push_back
(
-
1.0
);
altitudes
.
push_back
(
-
1.0
);
}
}
}
}
...
@@ -412,7 +432,7 @@ void TerrainTileManager::_terrainDone(QByteArray responseBytes, QNetworkReply::N
...
@@ -412,7 +432,7 @@ void TerrainTileManager::_terrainDone(QByteArray responseBytes, QNetworkReply::N
_state
=
State
::
Idle
;
_state
=
State
::
Idle
;
if
(
!
reply
)
{
if
(
!
reply
)
{
qC
Debu
g
(
TerrainQueryLog
)
<<
"Elevation tile fetched but invalid reply data type."
;
qC
Warnin
g
(
TerrainQueryLog
)
<<
"Elevation tile fetched but invalid reply data type."
;
return
;
return
;
}
}
...
@@ -422,13 +442,13 @@ void TerrainTileManager::_terrainDone(QByteArray responseBytes, QNetworkReply::N
...
@@ -422,13 +442,13 @@ void TerrainTileManager::_terrainDone(QByteArray responseBytes, QNetworkReply::N
// handle potential errors
// handle potential errors
if
(
error
!=
QNetworkReply
::
NoError
)
{
if
(
error
!=
QNetworkReply
::
NoError
)
{
qC
Debu
g
(
TerrainQueryLog
)
<<
"Elevation tile fetching returned error ("
<<
error
<<
")"
;
qC
Warnin
g
(
TerrainQueryLog
)
<<
"Elevation tile fetching returned error ("
<<
error
<<
")"
;
_tileFailed
();
_tileFailed
();
reply
->
deleteLater
();
reply
->
deleteLater
();
return
;
return
;
}
}
if
(
responseBytes
.
isEmpty
())
{
if
(
responseBytes
.
isEmpty
())
{
qC
Debu
g
(
TerrainQueryLog
)
<<
"Error in fetching elevation tile. Empty response."
;
qC
Warnin
g
(
TerrainQueryLog
)
<<
"Error in fetching elevation tile. Empty response."
;
_tileFailed
();
_tileFailed
();
reply
->
deleteLater
();
reply
->
deleteLater
();
return
;
return
;
...
@@ -446,7 +466,7 @@ void TerrainTileManager::_terrainDone(QByteArray responseBytes, QNetworkReply::N
...
@@ -446,7 +466,7 @@ void TerrainTileManager::_terrainDone(QByteArray responseBytes, QNetworkReply::N
}
}
_tilesMutex
.
unlock
();
_tilesMutex
.
unlock
();
}
else
{
}
else
{
qC
Debu
g
(
TerrainQueryLog
)
<<
"Received invalid tile"
;
qC
Warnin
g
(
TerrainQueryLog
)
<<
"Received invalid tile"
;
}
}
reply
->
deleteLater
();
reply
->
deleteLater
();
...
...
src/Terrain/TerrainQuery.h
View file @
72d3fecc
...
@@ -69,7 +69,8 @@ public:
...
@@ -69,7 +69,8 @@ public:
private
slots
:
private
slots
:
void
_requestError
(
QNetworkReply
::
NetworkError
code
);
void
_requestError
(
QNetworkReply
::
NetworkError
code
);
void
_requestFinished
();
void
_requestFinished
(
void
);
void
_sslErrors
(
const
QList
<
QSslError
>
&
errors
);
private:
private:
void
_sendQuery
(
const
QString
&
path
,
const
QUrlQuery
&
urlQuery
);
void
_sendQuery
(
const
QString
&
path
,
const
QUrlQuery
&
urlQuery
);
...
...
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