10 #include <QHostAddress> 14 #include <QTemporaryFile> 38 friend class HttpSessionStore;
43 enum RequestStatus {waitForRequest, waitForHeader, waitForBody, complete, abort};
49 HttpRequest(
const int maxRequestSize,
const int maxMultiPartSize);
62 void readFromSocket(QTcpSocket* socket);
71 QByteArray getMethod()
const;
74 QByteArray getPath()
const;
77 const QByteArray& getRawPath()
const;
80 QByteArray getVersion()
const;
88 QByteArray getHeader(
const QByteArray& name)
const;
94 QList<QByteArray> getHeaders(
const QByteArray& name)
const;
97 QMultiMap<QByteArray,QByteArray> getHeaderMap()
const;
105 QByteArray getParameter(
const QByteArray& name)
const;
111 QList<QByteArray> getParameters(
const QByteArray& name)
const;
114 QMultiMap<QByteArray,QByteArray> getParameterMap()
const;
117 QByteArray getBody()
const;
125 static QByteArray urlDecode(
const QByteArray source);
135 QTemporaryFile* getUploadedFile(
const QByteArray fieldName)
const;
141 QByteArray getCookie(
const QByteArray& name)
const;
144 QMap<QByteArray,QByteArray>& getCookieMap();
151 QHostAddress getPeerAddress()
const;
156 QMultiMap<QByteArray,QByteArray> headers;
159 QMultiMap<QByteArray,QByteArray> parameters;
162 QMap<QByteArray,QTemporaryFile*> uploadedFiles;
165 QMap<QByteArray,QByteArray> cookies;
177 QByteArray decodedPath;
189 QHostAddress peerAddress;
195 int maxMultiPartSize;
201 int expectedBodySize;
204 QByteArray currentHeader;
210 QTemporaryFile tempFile;
213 void parseMultiPartFile();
216 void readRequest(QTcpSocket* socket);
219 void readHeader(QTcpSocket* socket);
222 void readBody(QTcpSocket* socket);
225 void decodeRequestParams();
228 void extractCookies();
231 QByteArray lineBuffer;
235 #endif // HTTPREQUEST_H
This object represents a single HTTP request.
RequestStatus
Values for getStatus()