C++ Web Framework  3.0
Public Member Functions | Friends | List of all members
HttpParser Class Reference

The class parses a HTTP message. More...

#include <httpparser.h>

Public Member Functions

 HttpParser (QByteArray &httpMessage)
 This constructor receives a HTTP message and parses it. More...
 
qint64 getContentLenght () const noexcept
 Returns the content lenght. More...
 
QByteArray getContentType () const noexcept
 Returns the content type. More...
 
QByteArray getHttpVersion () const noexcept
 Returns the HTTP version. More...
 
QByteArray getMethod () const noexcept
 Returns HTTP method. More...
 
QByteArray getBody () const noexcept
 Returns HTTP body message. More...
 
QByteArray getSessionId () const noexcept
 Returns session id. More...
 
QByteArray getUrl () const noexcept
 Returns the url. More...
 
QByteArray getParameter (const QByteArray &name) const noexcept
 Returns a specific parameter given a name. If the parameter name does not exists, the function returns defaultValue. If no defaultValue is specified, the function returns a default-constructed value. If there are multiple parameters with a name, the value of the most recently inserted one is returned. More...
 
QByteArrayList getParameters (const QByteArray &name) const noexcept
 Returns all parameters with a specific name. More...
 
QMultiMap< QByteArray, QByteArray > getParameters () const noexcept
 Returns all parameters. More...
 
QMultiMap< QByteArray, QByteArray > getUploadedFiles () const noexcept
 Returns all uploaded files. More...
 
QVector< QNetworkCookie > getCookies () const noexcept
 Returns all cookies. More...
 
QByteArrayList getHeaderFields (const QByteArray &name) const noexcept
 Returns all header fields given a specific name. More...
 
QByteArray getHeaderField (const QByteArray &name) const noexcept
 Returns a specific header field given a name. If the header field name does not exists, the function returns defaultValue. If no defaultValue is specified, the function returns a default-constructed value. If there are multiple header field with a name, the value of the most recently inserted one is returned. More...
 
bool isValid () const noexcept
 Returns true if HTTP is valid, else it returns false. More...
 
bool isMultiPart () const noexcept
 Returns the multi part. More...
 
bool getReadFile () const noexcept
 Returns true if all message was read. More...
 

Friends

class HttpReadRequest
 

Detailed Description

The class parses a HTTP message.

Constructor & Destructor Documentation

◆ HttpParser()

HttpParser::HttpParser ( QByteArray &  httpMessage)
inlineexplicit

This constructor receives a HTTP message and parses it.

Parameters
QByteArray&httpMessage : HTTP message.

Member Function Documentation

◆ getBody()

QByteArray HttpParser::getBody ( ) const
inlinenoexcept

Returns HTTP body message.

Returns
QByteArray : HTTP body message.

◆ getContentLenght()

qint64 HttpParser::getContentLenght ( ) const
inlinenoexcept

Returns the content lenght.

Returns
qint64 : Content length.

◆ getContentType()

QByteArray HttpParser::getContentType ( ) const
inlinenoexcept

Returns the content type.

Returns
QByteArray : Content type.

◆ getCookies()

QVector<QNetworkCookie> HttpParser::getCookies ( ) const
inlinenoexcept

Returns all cookies.

Returns
QVector<QNetworkCookie> : Cookies.

◆ getHeaderField()

QByteArray HttpParser::getHeaderField ( const QByteArray &  name) const
inlinenoexcept

Returns a specific header field given a name. If the header field name does not exists, the function returns defaultValue. If no defaultValue is specified, the function returns a default-constructed value. If there are multiple header field with a name, the value of the most recently inserted one is returned.

Parameters
constQByteArray &name : Parameter name.
Returns
QByteArray : Parameter value.

◆ getHeaderFields()

QByteArrayList HttpParser::getHeaderFields ( const QByteArray &  name) const
inlinenoexcept

Returns all header fields given a specific name.

Parameters
constQByteArray &headerField : Header field name.
Returns
QByteArrayList : Header fields.

◆ getHttpVersion()

QByteArray HttpParser::getHttpVersion ( ) const
inlinenoexcept

Returns the HTTP version.

Returns
QByteArray : HTTP version.

◆ getMethod()

QByteArray HttpParser::getMethod ( ) const
inlinenoexcept

Returns HTTP method.

Returns
QByteArray : HTTP method.

◆ getParameter()

QByteArray HttpParser::getParameter ( const QByteArray &  name) const
inlinenoexcept

Returns a specific parameter given a name. If the parameter name does not exists, the function returns defaultValue. If no defaultValue is specified, the function returns a default-constructed value. If there are multiple parameters with a name, the value of the most recently inserted one is returned.

Parameters
constQByteArray &name : Parameter name.
Returns
QByteArray : Parameter value.

◆ getParameters() [1/2]

QByteArrayList HttpParser::getParameters ( const QByteArray &  name) const
inlinenoexcept

Returns all parameters with a specific name.

Parameters
constQByteArray &name : Parameter name.
Returns
QByteArrayList : Parameters list.

◆ getParameters() [2/2]

QMultiMap<QByteArray, QByteArray> HttpParser::getParameters ( ) const
inlinenoexcept

Returns all parameters.

Returns
QMap<QByteArray, QByteArray> : Parameters name and value.

◆ getReadFile()

bool HttpParser::getReadFile ( ) const
inlinenoexcept

Returns true if all message was read.

Returns
bool : Read file.

◆ getSessionId()

QByteArray HttpParser::getSessionId ( ) const
inlinenoexcept

Returns session id.

Returns
QByteArray : session id.

◆ getUploadedFiles()

QMultiMap<QByteArray, QByteArray> HttpParser::getUploadedFiles ( ) const
inlinenoexcept

Returns all uploaded files.

Returns
QMultiMap<QByteArray, QByteArray> : Files name and content.

◆ getUrl()

QByteArray HttpParser::getUrl ( ) const
inlinenoexcept

Returns the url.

Returns
QByteArray : url.

◆ isMultiPart()

bool HttpParser::isMultiPart ( ) const
inlinenoexcept

Returns the multi part.

Returns
bool : Multi part.

◆ isValid()

bool HttpParser::isValid ( ) const
inlinenoexcept

Returns true if HTTP is valid, else it returns false.

Returns
bool : HTTP message valid.

The documentation for this class was generated from the following files: