diff options
author | Dennis Oberst <dennis.oberst@qt.io> | 2025-09-03 16:42:34 +0200 |
---|---|---|
committer | Dennis Oberst <dennis.oberst@qt.io> | 2025-09-15 13:19:54 +0200 |
commit | e708eb5036bf4acc7d1d0b32d126233dd6b047e1 (patch) | |
tree | aa56e0ffc8ef97250471c43ebb2e7a39405444f8 | |
parent | 26d3ff4233a596e0f6aadc63b7269996e46a3143 (diff) |
docs: Add common http2-metadata description and distribute it6.9
Our documentation of what the QGrpcHttp2Channel should accept as
metadata was incomplete. Add the missing bits and give readers a link to
the original information, which is coming from RFC 7540.
Task-number: QTBUG-139558
Pick-to: 6.8
Change-Id: Ie170fd1f5300597b31dd49d47d5e01c469bf6ec3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 6f589e1d5c4c4a7254cffb4d24accfb87467c07b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit e16ff881c9a7cb910dbc73efb3ee563988854a5d)
-rw-r--r-- | src/grpc/doc/src/qtgrpc-shared.qdocinc | 9 | ||||
-rw-r--r-- | src/grpc/qgrpccalloptions.cpp | 7 | ||||
-rw-r--r-- | src/grpc/qgrpcchanneloptions.cpp | 4 | ||||
-rw-r--r-- | src/grpc/qgrpcoperation.cpp | 3 |
4 files changed, 16 insertions, 7 deletions
diff --git a/src/grpc/doc/src/qtgrpc-shared.qdocinc b/src/grpc/doc/src/qtgrpc-shared.qdocinc index cede8ec2..d8bd4506 100644 --- a/src/grpc/doc/src/qtgrpc-shared.qdocinc +++ b/src/grpc/doc/src/qtgrpc-shared.qdocinc @@ -26,3 +26,12 @@ \l{QGrpcOperation::} {finished} signal is emitted. After receiving this signal, the handler can be safely reassigned or destroyed. //! [rpc-lifetime-note] + +//! [http2-metadata-note] + \note QGrpcHttp2Channel transports metadata as HTTP/2 headers. \b{Keys} are + case-insensitive ASCII strings. You must avoid using the internal prefixes: + \c{:} (pseudo-header), \c{grpc-}, or \c{qtgrpc-}. \b{Values} may be either + ASCII strings or binary data. For more information, see + \l{https://www.rfc-editor.org/rfc/rfc7540.html#section-8.1.2}{RFC 7540, + Section 8.1.2}. +//! [http2-metadata-note] diff --git a/src/grpc/qgrpccalloptions.cpp b/src/grpc/qgrpccalloptions.cpp index a75c83cc..4dc9d067 100644 --- a/src/grpc/qgrpccalloptions.cpp +++ b/src/grpc/qgrpccalloptions.cpp @@ -125,10 +125,7 @@ QGrpcCallOptions &QGrpcCallOptions::setDeadlineTimeout(std::chrono::milliseconds Sets the client \a metadata for a specific RPC and returns a reference to the updated object. -//! [set-metadata-desc] - QGrpcHttp2Channel converts the metadata into appropriate HTTP/2 headers - which will be added to the HTTP/2 request. -//! [set-metadata-desc] + \include qtgrpc-shared.qdocinc http2-metadata-note \note Setting this field overrides the value set by QGrpcChannelOptions::setMetadata() for a specific RPC. @@ -171,6 +168,8 @@ std::optional<std::chrono::milliseconds> QGrpcCallOptions::deadlineTimeout() con Returns the client metadata for a specific RPC. If this field is unset, returns empty metadata. + + \include qtgrpc-shared.qdocinc http2-metadata-note */ const QHash<QByteArray, QByteArray> &QGrpcCallOptions::metadata() const & noexcept { diff --git a/src/grpc/qgrpcchanneloptions.cpp b/src/grpc/qgrpcchanneloptions.cpp index 37959b4b..c6200c74 100644 --- a/src/grpc/qgrpcchanneloptions.cpp +++ b/src/grpc/qgrpcchanneloptions.cpp @@ -127,7 +127,7 @@ QGrpcChannelOptions &QGrpcChannelOptions::setDeadlineTimeout(std::chrono::millis Sets the client \a metadata for the channel and returns a reference to the updated object. - \include qgrpccalloptions.cpp set-metadata-desc + \include qtgrpc-shared.qdocinc http2-metadata-note \note The metadata set via the channel options applies to all RPCs that operate on the channel, except those overridden by @@ -189,6 +189,8 @@ std::optional<std::chrono::milliseconds> QGrpcChannelOptions::deadlineTimeout() Returns the client metadata for the channel. If this field is unset, returns empty metadata. + + \include qtgrpc-shared.qdocinc http2-metadata-note */ const QHash<QByteArray, QByteArray> &QGrpcChannelOptions::metadata() const & noexcept { diff --git a/src/grpc/qgrpcoperation.cpp b/src/grpc/qgrpcoperation.cpp index 922c36f4..6d6e5705 100644 --- a/src/grpc/qgrpcoperation.cpp +++ b/src/grpc/qgrpcoperation.cpp @@ -158,8 +158,7 @@ void QGrpcOperation::cancel() /*! Returns the server metadata received from the channel. - \note For \l {QGrpcHttp2Channel} {HTTP/2 channels} it usually includes the - HTTP headers received from the server. + \include qtgrpc-shared.qdocinc http2-metadata-note */ const QHash<QByteArray, QByteArray> &QGrpcOperation::metadata() const & noexcept { |