diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2017-02-27 10:06:12 +0100 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2017-03-08 09:42:01 +0000 |
commit | 075e669cbe3cbbefe66d954e571db227e60eeda7 (patch) | |
tree | b89f98417f81096e54aa6369306c0e4cce0b8b57 /src/network/access/qhstspolicy.cpp | |
parent | 8afc6146be513e7adee6e4ade342e28951bfefc6 (diff) |
QHstsPolicy: Replace bool with QFlags
As pointed out in the previous code-review:
Replace a bool ctor parameter with QFlags<enum> to conform to
Qt API Design Principles (Boolean Parameter Trap).
Since the bool with its many unwanted implicit conversions is
gone from the ctor parameter list now, drop the explicit
keyword again. It was requested because of the boolean parameter
in the first place.
Change-Id: Ibaf287a6a3e38c22f033fd5d9e024c54f30a1fd4
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/network/access/qhstspolicy.cpp')
-rw-r--r-- | src/network/access/qhstspolicy.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/network/access/qhstspolicy.cpp b/src/network/access/qhstspolicy.cpp index 634bf4784b..0ea9f3f046 100644 --- a/src/network/access/qhstspolicy.cpp +++ b/src/network/access/qhstspolicy.cpp @@ -63,6 +63,14 @@ QT_BEGIN_NAMESPACE \sa QNetworkAccessManager::setStrictTransportSecurityEnabled() */ +/* + \enum QHstsPolicy::PolicyFlag + + Specifies attributes that a policy can have. + + \value IncludeSubDomains HSTS policy also applies to subdomains. +*/ + class QHstsPolicyPrivate : public QSharedData { public: @@ -101,13 +109,13 @@ QHstsPolicy::QHstsPolicy() : d(new QHstsPolicyPrivate) \sa QUrl::setHost(), QUrl::ParsingMode */ -QHstsPolicy::QHstsPolicy(const QDateTime &expiry, bool includeSubDomains, const QString &host, - QUrl::ParsingMode mode) +QHstsPolicy::QHstsPolicy(const QDateTime &expiry, PolicyFlags flags, + const QString &host, QUrl::ParsingMode mode) : d(new QHstsPolicyPrivate) { d->url.setHost(host, mode); d->expiry = expiry; - d->includeSubDomains = includeSubDomains; + d->includeSubDomains = flags.testFlag(IncludeSubDomains); } /*! |