TTKMusicPlayer
4.1.3.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
|
The class of the http request. More...
#include <qhttprequest.h>
Public Types | |
enum | HttpMethod { HTTP_DELETE = 0, HTTP_GET, HTTP_HEAD, HTTP_POST, HTTP_PUT, HTTP_CONNECT, HTTP_OPTIONS, HTTP_TRACE, HTTP_COPY, HTTP_LOCK, HTTP_MKCOL, HTTP_MOVE, HTTP_PROPFIND, HTTP_PROPPATCH, HTTP_SEARCH, HTTP_UNLOCK, HTTP_REPORT, HTTP_MKACTIVITY, HTTP_CHECKOUT, HTTP_MERGE, HTTP_MSEARCH, HTTP_NOTIFY, HTTP_SUBSCRIBE, HTTP_UNSUBSCRIBE, HTTP_PATCH, HTTP_PURGE } |
Request method enumeration. More... | |
Signals | |
void | data (const QByteArray &data) |
Emitted when new body data has been received. More... | |
void | end () |
Emitted when the request has been fully received. More... | |
Public Member Functions | |
HttpMethod | method () const |
The method used for the request. More... | |
const QString | methodString () const |
Returns the method string for the request. More... | |
const QUrl & | url () const |
The complete URL for the request. More... | |
const QString | path () const |
The path portion of the query URL. More... | |
const QString & | httpVersion () const |
The HTTP version of the request. More... | |
const HeaderHash & | headers () const |
Return all the headers sent by the client. More... | |
QString | header (const QString &field) |
Get the value of a header. More... | |
const QString & | remoteAddress () const |
IP Address of the client in dotted decimal format. More... | |
quint16 | remotePort () const |
Outbound connection port for the client. More... | |
const QByteArray & | body () const |
Request body data, empty for non POST/PUT requests. More... | |
bool | successful () const |
If this request was successfully received. More... | |
void | storeBody () |
Utility function to make this request store all body data internally. More... | |
Properties | |
HeaderHash | headers |
QString | remoteAddress |
quint16 | remotePort |
QString | method |
QUrl | url |
QString | path |
QString | httpVersion |
Private Slots | |
void | appendBody (const QByteArray &body) |
Private Member Functions | |
QHttpRequest (QHttpConnection *connection, QObject *parent=nullptr) | |
void | setMethod (HttpMethod method) |
void | setVersion (const QString &version) |
void | setUrl (const QUrl &url) |
void | setHeaders (const HeaderHash headers) |
void | setSuccessful (bool success) |
void | setRemoteAddress (const QString &address) |
void | setRemotePort (quint16 port) |
Static Private Member Functions | |
static QString | MethodToString (HttpMethod method) |
The class of the http request.
Definition at line 32 of file qhttprequest.h.
Request method enumeration.
Definition at line 53 of file qhttprequest.h.
|
explicitprivate |
Definition at line 34 of file qhttprequest.cpp.
References TTK_D, and TTK_INIT_PRIVATE.
|
privateslot |
const QByteArray & QHttpRequest::body | ( | ) | const |
Request body data, empty for non POST/PUT requests.
Definition at line 95 of file qhttprequest.cpp.
References TTK_D.
|
signal |
Emitted when new body data has been received.
data | Received data. |
Referenced by QHttpConnectionPrivate::Body(), and storeBody().
|
signal |
Emitted when the request has been fully received.
Referenced by QHttpConnectionPrivate::invalidateRequest(), and QHttpConnectionPrivate::MessageComplete().
QString QHttpRequest::header | ( | const QString & | field | ) |
Get the value of a header.
Headers are stored as lowercase so the input field
will be lowercased.
field | Name of the header field |
Definition at line 42 of file qhttprequest.cpp.
References TTK_D.
const HeaderHash& QHttpRequest::headers | ( | ) | const |
Return all the headers sent by the client.
This returns a reference. If you want to store headers somewhere else, where the request may be deleted, make sure you store them as a copy.
Referenced by setHeaders().
const QString& QHttpRequest::httpVersion | ( | ) | const |
The HTTP version of the request.
HttpMethod QHttpRequest::method | ( | ) | const |
The method used for the request.
Referenced by methodString(), and setMethod().
const QString QHttpRequest::methodString | ( | ) | const |
Returns the method string for the request.
Definition at line 72 of file qhttprequest.cpp.
References method(), and MethodToString().
|
staticprivate |
Definition at line 112 of file qhttprequest.cpp.
Referenced by methodString().
const QString& QHttpRequest::remoteAddress | ( | ) | const |
IP Address of the client in dotted decimal format.
quint16 QHttpRequest::remotePort | ( | ) | const |
Outbound connection port for the client.
|
private |
Definition at line 142 of file qhttprequest.cpp.
References headers(), and TTK_D.
Referenced by QHttpConnectionPrivate::HeadersComplete().
|
private |
Definition at line 124 of file qhttprequest.cpp.
References method(), and TTK_D.
Referenced by QHttpConnectionPrivate::HeadersComplete().
|
private |
Definition at line 154 of file qhttprequest.cpp.
References TTK_D.
Referenced by QHttpConnectionPrivate::HeadersComplete().
|
private |
Definition at line 160 of file qhttprequest.cpp.
References TTK_D.
Referenced by QHttpConnectionPrivate::HeadersComplete().
|
private |
Definition at line 148 of file qhttprequest.cpp.
References TTK_D.
Referenced by QHttpConnectionPrivate::MessageComplete().
|
private |
Definition at line 136 of file qhttprequest.cpp.
Referenced by QHttpConnectionPrivate::HeadersComplete().
|
private |
Definition at line 130 of file qhttprequest.cpp.
References TTK_D.
Referenced by QHttpConnectionPrivate::HeadersComplete().
void QHttpRequest::storeBody | ( | ) |
Utility function to make this request store all body data internally.
If you call this when the request is received via QHttpServer::newRequest() the request will take care of storing the body data for you. Once the end() signal is emitted you can access the body data with the body() function.
If you wish to handle incoming data yourself don't call this function and see the data() signal.
Definition at line 107 of file qhttprequest.cpp.
References appendBody(), and data().
bool QHttpRequest::successful | ( | ) | const |
If this request was successfully received.
Set before end() has been emitted, stating whether the message was properly received. This is false until the receiving the full request has completed.
Definition at line 101 of file qhttprequest.cpp.
References TTK_D.
Referenced by QHttpConnectionPrivate::invalidateRequest().
const QUrl& QHttpRequest::url | ( | ) | const |
|
read |
Definition at line 35 of file qhttprequest.h.
|
read |
Definition at line 41 of file qhttprequest.h.
|
read |
Definition at line 38 of file qhttprequest.h.
|
read |
Definition at line 40 of file qhttprequest.h.
Referenced by QDlnaFileServer::handleRequest().
|
read |
Definition at line 36 of file qhttprequest.h.
|
read |
Definition at line 37 of file qhttprequest.h.
|
read |
Definition at line 39 of file qhttprequest.h.