25class test_HttpRequest;
36 friend class ::test_HttpRequest;
39 [[nodiscard]]
static int onMessageBegin(
http_parser* pParser);
40 [[nodiscard]]
static int onMessageComplete(
http_parser* pParser);
41 [[nodiscard]]
static int onHeadersComplete(
http_parser* pParser);
42 [[nodiscard]]
static int onHeaderField(
http_parser* pParser,
const char*
const pPos,
size_t pLength);
43 [[nodiscard]]
static int onHeaderValue(
http_parser* pParser,
const char*
const pPos,
size_t pLength);
44 [[nodiscard]]
static int onBody(
http_parser* pParser,
const char*
const pPos,
size_t pLength);
45 [[nodiscard]]
static int onUrl(
http_parser* pParser,
const char*
const pPos,
size_t pLength);
47 static inline void add(QByteArray& pDest,
const char*
const pPos,
size_t pLength)
49 pDest += QByteArray(pPos,
static_cast<int>(pLength));
54 QMap<QByteArray, QByteArray> mHeader;
56 QPointer<QTcpSocket> mSocket;
61 QByteArray mCurrentHeaderField;
62 QByteArray mCurrentHeaderValue;
67 HttpRequest(QTcpSocket* pSocket, QObject* pParent =
nullptr);
72 [[nodiscard]] QByteArray
getMethod()
const;
75 [[nodiscard]] QByteArray
getHeader(
const QByteArray& pKey)
const;
76 [[nodiscard]]
const QMap<QByteArray, QByteArray>&
getHeader()
const;
77 [[nodiscard]] QUrl
getUrl()
const;
78 [[nodiscard]]
const QByteArray&
getBody()
const;
84 bool send(
const QByteArray& pResponse);
Definition: HttpRequest.h:33
void triggerSocketBuffer()
Definition: HttpRequest.cpp:128
QTcpSocket * take()
Definition: HttpRequest.cpp:47
bool isConnected() const
Definition: HttpRequest.cpp:68
void fireMessageComplete(HttpRequest *pSelf)
bool send(const HttpResponse &pResponse)
Definition: HttpRequest.cpp:134
quint16 getPeerPort() const
Definition: HttpRequest.cpp:116
QUrl getUrl() const
Definition: HttpRequest.cpp:104
quint16 getLocalPort() const
Definition: HttpRequest.cpp:122
void fireSocketStateChanged(QAbstractSocket::SocketState pSocketState)
const QMap< QByteArray, QByteArray > & getHeader() const
Definition: HttpRequest.cpp:98
const QByteArray & getBody() const
Definition: HttpRequest.cpp:110
~HttpRequest() override
Definition: HttpRequest.cpp:59
http_method getHttpMethod() const
Definition: HttpRequest.cpp:80
bool isUpgrade() const
Definition: HttpRequest.cpp:86
void fireSocketBuffer(const QByteArray &pBuffer)
QByteArray getMethod() const
Definition: HttpRequest.cpp:74
Definition: HttpResponse.h:19
Definition: HttpServer.h:24
http_method
Definition: http_parser.h:208
Implementation of GeneralAuthenticate response APDUs.
Definition: CommandApdu.h:16
Definition: http_parser.h:328
Definition: http_parser.h:296