23#ifndef QHTTPENGINE_QHTTPSOCKET_H
24#define QHTTPENGINE_QHTTPSOCKET_H
28#include "qhttpengine.h"
29#include "qhttpparser.h"
31class 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;
Implementation of the HTTP protocol.
Definition qhttpsocket.h:89
virtual void close()
Close the device and underlying socket.
virtual qint64 readData(char *data, qint64 maxlen)
Implementation of QIODevice::readData()
QHttpHeaderMap headers() const
Retrieve a map of request headers.
qint64 contentLength() const
Retrieve the length of the content.
QHttpSocket(QTcpSocket *socket, QObject *parent=0)
Create a new QHttpSocket from a QTcpSocket.
QByteArray method() const
Retrieve the request method.
virtual bool isSequential() const
Determine if the device is sequential.
virtual qint64 bytesAvailable() const
Retrieve the number of bytes available for reading.
void setStatusCode(int statusCode, const QByteArray &statusReason=QByteArray())
Set the response code.
void setHeaders(const QHttpHeaderMap &headers)
Set the response headers.
void writeError(int statusCode, const QByteArray &statusReason=QByteArray())
Write an HTTP error to the socket.
void writeRedirect(const QByteArray &path, bool permanent=false)
Write an HTTP 3xx redirect to the socket.
QByteArray path() const
Retrieve the request path.
bool isHeadersParsed() const
Determine if the request headers have been parsed yet.
void setHeader(const QByteArray &name, const QByteArray &value)
Set a response header to a specific value.
void headersParsed()
Indicate that request headers have been parsed.
virtual qint64 writeData(const char *data, qint64 len)
Implementation of QIODevice::writeData()
void writeHeaders()
Write response headers to the socket.