In questa pagina

QHttpServerRequest Class

Incapsula una richiesta HTTP. Maggiori informazioni...

Intestazione: #include <QHttpServerRequest>
CMake: find_package(Qt6 REQUIRED COMPONENTS HttpServer)
target_link_libraries(mytarget PRIVATE Qt6::HttpServer)
qmake: QT += httpserver
A partire da: Qt 6.4

Tipi pubblici

enum class Method { Unknown, Get, Put, Delete, Post, …, AnyKnown }
flags Methods

Funzioni pubbliche

(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)
QDebug operator<<(QDebug debug, const QHttpServerRequest &request)

Descrizione dettagliata

API per l'accesso ai diversi parametri di una richiesta in entrata.

Documentazione sui tipi membro

enum class QHttpServerRequest::Method
flags QHttpServerRequest::Methods

Questo tipo di enumerazione specifica un metodo di richiesta HTTP:

CostanteValoreDescrizione
QHttpServerRequest::Method::Unknown0x0000Un metodo sconosciuto.
QHttpServerRequest::Method::Get0x0001Metodo HTTP GET.
QHttpServerRequest::Method::Put0x0002Metodo HTTP PUT.
QHttpServerRequest::Method::Delete0x0004Metodo HTTP DELETE.
QHttpServerRequest::Method::Post0x0008Metodo HTTP POST.
QHttpServerRequest::Method::Head0x0010Metodo HTTP HEAD.
QHttpServerRequest::Method::Options0x0020Metodo HTTP OPTIONS.
QHttpServerRequest::Method::Patch0x0040Metodo HTTP PATCH (RFC 5789).
QHttpServerRequest::Method::Connect0x0080Metodo HTTP CONNECT.
QHttpServerRequest::Method::Trace0x0100Metodo HTTP TRACE.
QHttpServerRequest::Method::AnyKnownGet | Put | Delete | Post | Head | Options | Patch | Connect | TraceCombinazione di tutti i metodi noti.

Il tipo Methods è un typedef per QFlags<Method>. Memorizza una combinazione OR di valori Method.

Documentazione delle funzioni membro

[since 6.10] QHttpServerRequest::QHttpServerRequest()

Crea un oggetto QHttpServerRequest.

Questa funzione è stata introdotta in Qt 6.10.

[since 6.10] QHttpServerRequest::QHttpServerRequest(const QHttpServerRequest &other)

La funzione `Copy` crea un oggetto `QHttpServerRequest` utilizzando ` other`.

Questa funzione è stata introdotta in Qt 6.10.

[constexpr noexcept default, since 6.10] QHttpServerRequest::QHttpServerRequest(QHttpServerRequest &&other)

Move crea un oggetto `QHttpServerRequest` utilizzando ` other`.

Questa funzione è stata introdotta in Qt 6.10.

[noexcept] QHttpServerRequest::~QHttpServerRequest()

Distrugge un QHttpServerRequest

QByteArray QHttpServerRequest::body() const

Restituisce il corpo della richiesta.

QHttpHeaders QHttpServerRequest::headers() &&

const QHttpHeaders &QHttpServerRequest::headers() const &

Restituisce tutte le intestazioni della richiesta.

[since 6.5] QHostAddress QHttpServerRequest::localAddress() const

Restituisce l'indirizzo host del socket locale che ha ricevuto la richiesta.

Questa funzione è stata introdotta in Qt 6.5.

[since 6.5] quint16 QHttpServerRequest::localPort() const

Restituisce la porta del socket locale che ha ricevuto la richiesta.

Questa funzione è stata introdotta in Qt 6.5.

QHttpServerRequest::Method QHttpServerRequest::method() const

Restituisce il metodo della richiesta.

QUrlQuery QHttpServerRequest::query() const

Restituisce la query contenuta nella richiesta.

QHostAddress QHttpServerRequest::remoteAddress() const

Restituisce l'indirizzo dell'host di origine della richiesta.

[since 6.5] quint16 QHttpServerRequest::remotePort() const

Restituisce la porta dell'host di origine della richiesta.

Questa funzione è stata introdotta in Qt 6.5.

[since 6.7] QSslConfiguration QHttpServerRequest::sslConfiguration() const

Restituisce la configurazione della connessione TLS stabilita. Se la connessione non utilizza TLS, la configurazione restituirà "true" alla chiamata a isNull().

Questa funzione è stata introdotta in Qt 6.7.

[noexcept, since 6.10] void QHttpServerRequest::swap(QHttpServerRequest &other)

Scambia i valori tra questa pagina e other.

Questa funzione è stata introdotta in Qt 6.10.

QUrl QHttpServerRequest::url() const

Restituisce l'URL richiesto dalla richiesta.

QByteArray QHttpServerRequest::value(const QByteArray &key) const

Restituisce il valore combinato di tutte le intestazioni con il nome key.

[noexcept, since 6.10] QHttpServerRequest &QHttpServerRequest::operator=(QHttpServerRequest &&other)

La funzione `Move` assegna un oggetto di tipo ` QHttpServerRequest ` utilizzando ` other`.

Questa funzione è stata introdotta in Qt 6.10.

[since 6.10] QHttpServerRequest &QHttpServerRequest::operator=(const QHttpServerRequest &other)

Assegna un oggetto ` QHttpServerRequest ` utilizzando ` other`.

Questa funzione è stata introdotta in Qt 6.10.

Elementi non membri correlati

QDebug operator<<(QDebug debug, const QHttpServerRequest &request)

Scrive le informazioni relative a request nel flusso debug.

Vedi anche 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.