25 : m_connection(nullptr),
26 m_url(
"http://localhost/"),
39 d->m_connection = connection;
45 return d->m_headers.value(field.toLower(),
"");
69 return d->m_url.path();
86 return d->m_remoteAddress;
92 return d->m_remotePort;
109 connect(
this, SIGNAL(
data(
const QByteArray &)),
this, SLOT(
appendBody(
const QByteArray &)), Qt::UniqueConnection);
114 const int index = staticMetaObject.indexOfEnumerator(
"HttpMethod");
115 return staticMetaObject.enumerator(index).valueToKey(method);
121 d->m_body.append(body);
133 d->m_version = version;
151 d->m_success = success;
157 d->m_remoteAddress = address;
163 d->m_remotePort = port;
HttpMethod
Request method enumeration.
The class of the http connection.
void setUrl(const QUrl &url)
const QString methodString() const
Returns the method string for the request.
void setHeaders(const HeaderHash headers)
const QByteArray & body() const
Request body data, empty for non POST/PUT requests.
void setRemotePort(quint16 port)
void storeBody()
Utility function to make this request store all body data internally.
QHttpRequest(QHttpConnection *connection, QObject *parent=nullptr)
The class of the http request.
void data(const QByteArray &data)
Emitted when new body data has been received.
QString header(const QString &field)
Get the value of a header.
const QString & httpVersion() const
The HTTP version of the request.
void setSuccessful(bool success)
void setVersion(const QString &version)
bool successful() const
If this request was successfully received.
void setRemoteAddress(const QString &address)
quint16 remotePort() const
Outbound connection port for the client.
void setMethod(HttpMethod method)
static QString MethodToString(HttpMethod method)
HttpMethod method() const
The method used for the request.
QHash< QString, QString > HeaderHash
QHttpConnection * m_connection
const QUrl & url() const
The complete URL for the request.
const QString & remoteAddress() const
IP Address of the client in dotted decimal format.
const QString path() const
The path portion of the query URL.
QHttpRequest::HttpMethod m_method
#define TTK_INIT_PRIVATE(Class)
void appendBody(const QByteArray &body)
The class of the http request private.
The class of the ttk private base.
const HeaderHash & headers() const
Return all the headers sent by the client.