QHttpEngine 0.1.0
Simple and secure HTTP server for Qt applications
|
Utility methods for parsing HTTP requests and responses. More...
#include <QHttpEngine/QHttpParser>
Static Public Member Functions | |
static bool | parseHeaderList (const QList< QByteArray > &lines, QHttpHeaderMap &headers) |
Parse a list of lines containing HTTP headers. | |
static bool | parseHeaders (const QByteArray &data, QList< QByteArray > &parts, QHttpHeaderMap &headers) |
Parse HTTP headers. | |
static bool | parseRequestHeaders (const QByteArray &data, QByteArray &method, QByteArray &path, QHttpHeaderMap &headers) |
Parse HTTP request headers. | |
static bool | parseResponseHeaders (const QByteArray &data, int &statusCode, QByteArray &statusReason, QHttpHeaderMap &headers) |
Parse HTTP response headers. | |
static void | split (const QByteArray &data, const QByteArray &delim, int maxSplit, QList< QByteArray > &parts) |
Split a QByteArray by the provided delimiter. | |
This class provides a set of static methods for parsing HTTP request and response headers. Functionality is broken up into smaller methods in order to make the unit tests simpler.
|
static |
Each line is expected to be in the format "name: value". Parsing is immediately aborted if an invalid line is encountered.
|
static |
The specified header data (everything up to the double CRLF) is parsed into a status line and HTTP headers. The parts list will contain the parts from the status line.
|
static |
If the delimiter is not present in the QByteArray, the resulting list will contain the original QByteArray as its only element. The delimiter must not be empty.
If maxSplit is nonzero, the list will contain no more than maxSplit + 1 items. If maxSplit is equal to zero, there will be no limit on the number of splits performed.