QHttpEngine
0.1.0
Simple and secure HTTP server for Qt applications
|
23 #ifndef QHTTPENGINE_QHTTPSOCKET_H
24 #define QHTTPENGINE_QHTTPSOCKET_H
28 #include "qhttpengine.h"
29 #include "qhttpparser.h"
31 class QHTTPENGINE_EXPORT QHttpSocketPrivate;
101 MovedPermanently = 301,
111 MethodNotAllowed = 405,
113 InternalServerError = 500
194 void setStatusCode(
int statusCode,
const QByteArray &statusReason = QByteArray());
203 void setHeader(
const QByteArray &name,
const QByteArray &value);
229 void writeError(
int statusCode,
const QByteArray &statusReason = QByteArray());
248 virtual qint64
readData(
char *data, qint64 maxlen);
257 QHttpSocketPrivate *
const d;
258 friend class QHttpSocketPrivate;
261 #endif // QHTTPENGINE_QHTTPSOCKET_H
bool isHeadersParsed() const
Determine if the request headers have been parsed yet.
QHttpSocket(QTcpSocket *socket, QObject *parent=0)
Create a new QHttpSocket from a QTcpSocket.
QByteArray method() const
Retrieve the request method.
QByteArray path() const
Retrieve the request path.
virtual bool isSequential() const
Determine if the device is sequential.
qint64 contentLength() const
Retrieve the length of the content.
void writeRedirect(const QByteArray &path, bool permanent=false)
Write an HTTP 3xx redirect to the socket.
virtual void close()
Close the device and underlying socket.
void setHeader(const QByteArray &name, const QByteArray &value)
Set a response header to a specific value.
Implementation of the HTTP protocol.
Definition: qhttpsocket.h:89
void writeHeaders()
Write response headers to the socket.
void setStatusCode(int statusCode, const QByteArray &statusReason=QByteArray())
Set the response code.
virtual qint64 writeData(const char *data, qint64 len)
Implementation of QIODevice::writeData()
void headersParsed()
Indicate that request headers have been parsed.
QHttpHeaderMap headers() const
Retrieve a map of request headers.
virtual qint64 bytesAvailable() const
Retrieve the number of bytes available for reading.
void writeError(int statusCode, const QByteArray &statusReason=QByteArray())
Write an HTTP error to the socket.
void setHeaders(const QHttpHeaderMap &headers)
Set the response headers.
virtual qint64 readData(char *data, qint64 maxlen)
Implementation of QIODevice::readData()