QHttpServerRequest Class
Kapseln eine HTTP-Anfrage. Mehr...
| Header: | #include <QHttpServerRequest> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS HttpServer) target_link_libraries(mytarget PRIVATE Qt6::HttpServer) |
| qmake: | QT += httpserver |
| Seit: | Qt 6.4 |
Öffentliche Typen
Öffentliche Funktionen
(since 6.10) | QHttpServerRequest() |
(since 6.10) | QHttpServerRequest(const QHttpServerRequest &other) |
(since 6.10) | QHttpServerRequest(QHttpServerRequest &&other) |
| ~QHttpServerRequest() | |
| QByteArray | body() const |
| QHttpHeaders | headers() && |
| const QHttpHeaders & | headers() const & |
(since 6.5) QHostAddress | localAddress() const |
(since 6.5) quint16 | localPort() const |
| QHttpServerRequest::Method | method() const |
| QUrlQuery | query() const |
| QHostAddress | remoteAddress() const |
(since 6.5) quint16 | remotePort() const |
(since 6.7) QSslConfiguration | sslConfiguration() const |
(since 6.10) void | swap(QHttpServerRequest &other) |
| QUrl | url() const |
| QByteArray | value(const QByteArray &key) const |
(since 6.10) QHttpServerRequest & | operator=(QHttpServerRequest &&other) |
(since 6.10) QHttpServerRequest & | operator=(const QHttpServerRequest &other) |
Verwandte Nicht-Mitglieder
| QDebug | operator<<(QDebug debug, const QHttpServerRequest &request) |
Ausführliche Beschreibung
API für den Zugriff auf die verschiedenen Parameter einer eingehenden Anfrage.
Dokumentation zu Mitgliedstypen
enum class QHttpServerRequest::Method
flags QHttpServerRequest::Methods
Dieser Enum-Typ gibt eine HTTP-Anfragemethode an:
| Konstante | Wert | Beschreibung |
|---|---|---|
QHttpServerRequest::Method::Unknown | 0x0000 | Eine unbekannte Methode. |
QHttpServerRequest::Method::Get | 0x0001 | HTTP-GET-Methode. |
QHttpServerRequest::Method::Put | 0x0002 | HTTP-PUT-Methode. |
QHttpServerRequest::Method::Delete | 0x0004 | HTTP-DELETE-Methode. |
QHttpServerRequest::Method::Post | 0x0008 | HTTP-POST-Methode. |
QHttpServerRequest::Method::Head | 0x0010 | HTTP-HEAD-Methode. |
QHttpServerRequest::Method::Options | 0x0020 | HTTP-OPTIONS-Methode. |
QHttpServerRequest::Method::Patch | 0x0040 | HTTP-PATCH-Methode (RFC 5789). |
QHttpServerRequest::Method::Connect | 0x0080 | HTTP-CONNECT-Methode. |
QHttpServerRequest::Method::Trace | 0x0100 | HTTP-TRACE-Methode. |
QHttpServerRequest::Method::AnyKnown | Get | Put | Delete | Post | Head | Options | Patch | Connect | Trace | Kombination aller bekannten Methoden. |
Der Typ „Methods“ ist ein `typedef` für ` QFlags<Method>`. Er speichert eine ODER-Kombination von `Method`-Werten.
Dokumentation der Member-Funktionen
[since 6.10] QHttpServerRequest::QHttpServerRequest()
Erstellt einen QHttpServerRequest.
Diese Funktion wurde in Qt 6.10 eingeführt.
[since 6.10] QHttpServerRequest::QHttpServerRequest(const QHttpServerRequest &other)
„Copy“ erstellt einen QHttpServerRequest mithilfe von „ other “.
Diese Funktion wurde in Qt 6.10 eingeführt.
[constexpr noexcept default, since 6.10] QHttpServerRequest::QHttpServerRequest(QHttpServerRequest &&other)
Move erstellt einen QHttpServerRequest mithilfe von ` other`.
Diese Funktion wurde in Qt 6.10 eingeführt.
[noexcept] QHttpServerRequest::~QHttpServerRequest()
Zerstört ein QHttpServerRequest
QByteArray QHttpServerRequest::body() const
Gibt den Hauptteil der Anfrage zurück.
QHttpHeaders QHttpServerRequest::headers() &&
const QHttpHeaders &QHttpServerRequest::headers() const &
Gibt alle Request-Header zurück.
[since 6.5] QHostAddress QHttpServerRequest::localAddress() const
Gibt die Host-Adresse des lokalen Sockets zurück, der die Anfrage empfangen hat.
Diese Funktion wurde in Qt 6.5 eingeführt.
[since 6.5] quint16 QHttpServerRequest::localPort() const
Gibt den Port des lokalen Sockets zurück, der die Anfrage empfangen hat.
Diese Funktion wurde in Qt 6.5 eingeführt.
QHttpServerRequest::Method QHttpServerRequest::method() const
Gibt die Methode der Anfrage zurück.
QUrlQuery QHttpServerRequest::query() const
Gibt die Abfrage aus der Anfrage zurück.
QHostAddress QHttpServerRequest::remoteAddress() const
Gibt die Adresse des Ursprungshosts der Anfrage zurück.
[since 6.5] quint16 QHttpServerRequest::remotePort() const
Gibt den Port des Ursprungshosts der Anfrage zurück.
Diese Funktion wurde in Qt 6.5 eingeführt.
[since 6.7] QSslConfiguration QHttpServerRequest::sslConfiguration() const
Gibt die Konfiguration der hergestellten TLS-Verbindung zurück. Die Konfigurationen geben bei „isNull()“ den Wert „true“ zurück, wenn die Verbindung kein TLS verwendet.
Diese Funktion wurde in Qt 6.7 eingeführt.
[noexcept, since 6.10] void QHttpServerRequest::swap(QHttpServerRequest &other)
Tauscht die Werte zwischen dieser Funktion und „ other “ aus.
Diese Funktion wurde in Qt 6.10 eingeführt.
QUrl QHttpServerRequest::url() const
Gibt die URL zurück, die in der Anfrage angefordert wurde.
QByteArray QHttpServerRequest::value(const QByteArray &key) const
Gibt den kombinierten Wert aller Header mit dem Namen „ key “ zurück.
[noexcept, since 6.10] QHttpServerRequest &QHttpServerRequest::operator=(QHttpServerRequest &&other)
Die Funktion „Move“ weist eine „ QHttpServerRequest “ unter Verwendung von „ other “ zu.
Diese Funktion wurde in Qt 6.10 eingeführt.
[since 6.10] QHttpServerRequest &QHttpServerRequest::operator=(const QHttpServerRequest &other)
Weist unter Verwendung von ` other` einen ` QHttpServerRequest ` zu.
Diese Funktion wurde in Qt 6.10 eingeführt.
Verwandte Nicht-Mitglieder
QDebug operator<<(QDebug debug, const QHttpServerRequest &request)
Schreibt Informationen über request in den Stream „ debug “.
Siehe auch QDebug.
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.