-
Notifications
You must be signed in to change notification settings - Fork 158
/
qhttpserverrequest.hpp
82 lines (63 loc) · 2.58 KB
/
qhttpserverrequest.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/** HTTP request which is received by the server.
* https://github.com/azadkuh/qhttp
*
* @author amir zamani
* @version 2.0.0
* @date 2014-07-11
*/
#ifndef QHTTPSERVER_REQUEST_HPP
#define QHTTPSERVER_REQUEST_HPP
///////////////////////////////////////////////////////////////////////////////
#include "qhttpabstracts.hpp"
#include <QUrl>
///////////////////////////////////////////////////////////////////////////////
namespace qhttp {
namespace server {
///////////////////////////////////////////////////////////////////////////////
/** The QHttpRequest class represents the header and body data sent by the client.
* The class is <b>read-only</b>.
* @sa QHttpConnection
*/
class QHTTP_API QHttpRequest : public QHttpAbstractInput
{
Q_OBJECT
public:
virtual ~QHttpRequest();
public: // QHttpAbstractInput methods:
/** @see QHttpAbstractInput::headers(). */
const THeaderHash& headers() const override;
/** @see QHttpAbstractInput::httpVersion(). */
const QString& httpVersion() const override;
/** @see QHttpAbstractInput::isSuccessful(). */
bool isSuccessful() const override;
/** @see QHttpAbstractInput::collectData(). */
void collectData(int atMost = -1) override;
/** @see QHttpAbstractInput::collectedData(). */
const QByteArray& collectedData()const override;
public:
/** The method used for the request. */
THttpMethod method() const ;
/** Returns the method string for the request.
* @note This will plainly transform the enum into a string HTTP_GET -> "HTTP_GET". */
const QString methodString() const;
/** The complete URL for the request.
* This includes the path and query string. @sa path(). */
const QUrl& url() const;
/** IP Address of the client in dotted decimal format. */
const QString& remoteAddress() const;
/** Outbound connection port for the client. */
quint16 remotePort() const;
/** returns the parent QHttpConnection object. */
QHttpConnection* connection() const;
protected:
explicit QHttpRequest(QHttpConnection*);
explicit QHttpRequest(QHttpRequestPrivate&, QHttpConnection*);
friend class QHttpConnectionPrivate;
Q_DECLARE_PRIVATE(QHttpRequest)
QScopedPointer<QHttpRequestPrivate> d_ptr;
};
///////////////////////////////////////////////////////////////////////////////
} // namespace server
} // namespace qhttp
///////////////////////////////////////////////////////////////////////////////
#endif // define QHTTPSERVER_REQUEST_HPP