8 #ifndef _HttpResponse_H_ 9 #define _HttpResponse_H_ 43 void setHeader(
const QString& name,
const QString& value);
48 void setHeader(
const QString& name,
int value);
64 QMap<QString, QString>&
headers();
74 const QMap<QString, HttpCookie>&
cookies()
const {
return m_cookies; };
84 void setStatus(
int code,
const QString& description = QString());
94 void write(
const QByteArray& data);
136 void flushAndClose();
138 void flushAndDelete();
148 void slotWrite(
bool startTimer =
true);
149 void socketDisconnected();
150 void socketError(QAbstractSocket::SocketError);
153 #ifndef DOXYGEN_SHOULD_SKIP_THIS 154 QTcpSocket *m_socket;
157 QMap<QString, QString> m_headers;
158 QMap<QString, HttpCookie> m_cookies;
161 QString m_statusText;
165 void writeToSocket(
const QByteArray& data);
168 QTimer *m_writerTimer;
170 QByteArray m_dataBody;
171 QByteArray m_dataHeaders;
172 int m_dataBodyPointer;
173 int m_dataHeadersPointer;
174 bool m_canWriteToSocket;
175 bool m_closeAfterFlush;
176 bool m_deleteAfterFlush;
const QMap< QString, HttpCookie > & cookies() const
Returns cookies of the response in QMap.
HttpResponse(HttpConnection *)
Constructor sets default values for headers (status 200, OK)
HttpCookie cookie(const QString &name)
Returns cookie.
One cookie of HTTP protocol.
void flush()
Writes last part of the response and closes the socket when possible.
void setSendHeaders(bool send)
Sets the header sending.
Response to HTTP request - headers, cookies and body.
void flushSocket()
Flushed sockets data to network.
QString value() const
Returns the value of cookie.
void write(const QByteArray &data)
Writes data to response body.
void setCookie(const HttpCookie &cookie)
Sets a cookie.
bool containsHeader(const QString &name)
Returns true if headers contains specific header.
bool isConnected() const
Returns true if the http connection is in connected state.
void setStatus(int code, const QString &description=QString())
Set the status code and the description of the response.
void close()
Closes socket and destroys connection. Should by called only when "chunked" transport is choosen...
bool chunked()
Returns true if the trasport mode is chunked.
void setHeader(const QString &name, const QString &value)
Sets or rewrite one header.
void clearHeaders()
Clears all headers set.
Namespace of HTTP server.
QMap< QString, QString > & headers()
Returns headers of the response in QMap.
One single connection to http server.