diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2025-01-23 10:38:12 +0100 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2025-01-24 16:57:00 +0100 |
| commit | 14de00d03d5593379eed25d9ff93765d2bd635d0 (patch) | |
| tree | 68459cf52462c0ca24798ba05f00f8736756e379 /src/oauth/qoauth2authorizationcodeflow.cpp | |
| parent | 9545e956e745c61bbdf5152333a35848f13e587f (diff) | |
Rest of code: use toLatin1() on FullEncoded URLs
A FullyEncoded URL is US-ASCII-only, so use the faster toLatin1(),
and make sure it's called on an rvalue.
(Called on an unshared rvalue QString, fromLatin1() is guaranteed to
re-use the internal buffer without reallocation; unlike toUtf8(),
which always has to stay prepared for a reallocation, in case a
UTF-16 code unit (2 bytes) requires three UTF-8 ones (three bytes)).
Amends a6dc1c01da723a93e1c174a6950eb4bab8cab3fc and
155624c3772b86145d8d84dbca87ab85e8c9c571.
Pick-to: 6.9 6.8
Change-Id: I1e61500e23aada3fa9270f7f38148831cd59ce62
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/oauth/qoauth2authorizationcodeflow.cpp')
| -rw-r--r-- | src/oauth/qoauth2authorizationcodeflow.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/oauth/qoauth2authorizationcodeflow.cpp b/src/oauth/qoauth2authorizationcodeflow.cpp index f0aef1d..0cabf43 100644 --- a/src/oauth/qoauth2authorizationcodeflow.cpp +++ b/src/oauth/qoauth2authorizationcodeflow.cpp @@ -522,11 +522,11 @@ void QOAuth2AuthorizationCodeFlow::requestAccessToken(const QString &code) request.setHeader(QNetworkRequest::ContentTypeHeader, QStringLiteral("application/x-www-form-urlencoded")); - const QString data = query.toString(QUrl::FullyEncoded); + const QByteArray data = query.toString(QUrl::FullyEncoded).toLatin1(); d->callNetworkRequestModifier(request, QAbstractOAuth::Stage::RequestingAccessToken); - QNetworkReply *reply = d->networkAccessManager()->post(request, data.toUtf8()); + QNetworkReply *reply = d->networkAccessManager()->post(request, data); d->currentReply = reply; QAbstractOAuthReplyHandler *handler = replyHandler(); QObject::connect(reply, &QNetworkReply::finished, handler, |
