Cutelyst  1.5.0
Public Member Functions | List of all members
Cutelyst::Headers Class Reference

Public Member Functions

 Headers (std::initializer_list< std::pair< QString, QString > > list)
 
QString authorization () const
 
QString authorizationBasic () const
 
QPair< QString, QString > authorizationBasicPair () const
 
QHash< QString, QString > authorizationDigest () const
 
void clear ()
 
QString connection () const
 
bool contains (const QString &field)
 
QString contentEncoding () const
 
bool contentIsHtml () const
 
bool contentIsText () const
 
bool contentIsXHtml () const
 
bool contentIsXml () const
 
qint64 contentLength () const
 
QString contentType () const
 
QString contentTypeCharset () const
 
QHash< QString, QString > data () const
 
QDateTime date () const
 
QString header (const QString &field) const
 
QString header (const QString &field, const QString &defaultValue) const
 
QString host () const
 
QString ifModifiedSince () const
 
QDateTime ifModifiedSinceDateTime () const
 
QString lastModified () const
 
 operator QVariant () const
 
bool operator!= (const Headers &other) const
 
Headersoperator= (const Headers &other)
 
bool operator== (const Headers &other) const
 
QString & operator[] (const QString &key)
 
const QString operator[] (const QString &key) const
 
QString proxyAuthorization () const
 
QString proxyAuthorizationBasic () const
 
QPair< QString, QString > proxyAuthorizationBasicPair () const
 
void pushHeader (const QString &field, const QString &value)
 
void pushHeader (const QString &field, const QStringList &values)
 
void pushRawHeader (const QString &field, const QString &value)
 
QString referer () const
 
void removeHeader (const QString &field)
 
QString server () const
 
QString setAuthorizationBasic (const QString &username, const QString &password)
 
void setContentEncoding (const QString &encoding)
 
void setContentLength (qint64 value)
 
void setContentType (const QString &contentType)
 
void setContentTypeCharset (const QString &charset)
 
QString setDateWithDateTime (const QDateTime &date)
 
void setHeader (const QString &field, const QString &value)
 
void setHeader (const QString &field, const QStringList &values)
 
void setLastModified (const QString &value)
 
QString setLastModified (const QDateTime &lastModified)
 
void setProxyAuthenticate (const QString &value)
 
void setReferer (const QString &value)
 
void setServer (const QString &value)
 
void setWwwAuthenticate (const QString &value)
 
QString userAgent () const
 

Detailed Description

Definition at line 30 of file headers.h.

Member Function Documentation

QString Cutelyst::Headers::authorization ( ) const

This method is used to get an authorization header without any decoding.

QString Cutelyst::Headers::authorizationBasic ( ) const

This method is used to get an authorization header that use the "Basic Authentication Scheme". It will return "username:password" as a single string value.

QPair<QString, QString> Cutelyst::Headers::authorizationBasicPair ( ) const

This method is used to get an authorization header that use the "Basic Authentication Scheme". It will return a pair of username and password respectively.

QHash<QString, QString> Cutelyst::Headers::authorizationDigest ( ) const

This method is used to get all the fields that build a "Digest Authentication Scheme". It will return a Hash containing keys and values.

bool Cutelyst::Headers::contentIsHtml ( ) const

Returns TRUE if the Content-Type header field indicate that the content is some kind of HTML (including XHTML).

bool Cutelyst::Headers::contentIsText ( ) const

Returns TRUE if the Content-Type header field indicate that the content is textual.

bool Cutelyst::Headers::contentIsXHtml ( ) const

Returns TRUE if the Content-Type header field indicate that the content is XHTML.

bool Cutelyst::Headers::contentIsXml ( ) const

Returns TRUE if the Content-Type header field indicate that the content is XML.

qint64 Cutelyst::Headers::contentLength ( ) const

Returns the size in bytes of the message content

QString Cutelyst::Headers::contentType ( ) const

The Content-Type header field indicates the media type of the message content. E.g.: "text/html" The value returned will be converted to lower case, and potential parameters will be ignored. If there is no such header field, then the empty string is returned.

QString Cutelyst::Headers::contentTypeCharset ( ) const

Returns the upper-cased charset specified in the Content-Type header.

QDateTime Cutelyst::Headers::date ( ) const

Returns the date header as QDateTime

QString Cutelyst::Headers::ifModifiedSince ( ) const

This header fields is used to make a request conditional. If the requested resource has (or has not) been modified since the time specified in this field, then the server will return a 304 Not Modified response instead of the document itself.

QDateTime Cutelyst::Headers::ifModifiedSinceDateTime ( ) const

This header fields is used to make a request conditional. If the requested resource has (or has not) been modified since the time specified in this field, then the server will return a 304 Not Modified response instead of the document itself. This method parses the header and convert to QDateTime assuming the date is in GMT timezone.

QString Cutelyst::Headers::lastModified ( ) const

This header indicates the date and time at which the resource was last modified.

QString Cutelyst::Headers::proxyAuthorization ( ) const

A user agent that wishes to authenticate itself with a server or a proxy, may do so by including these headers.

QString Cutelyst::Headers::proxyAuthorizationBasic ( ) const

This method is used to get an authorization header that use the "Basic Authentication Scheme" but using the "Proxy-Authorization" header instead. It will return "username:password" as a single string value.

QPair<QString, QString> Cutelyst::Headers::proxyAuthorizationBasicPair ( ) const

This method is used to get an authorization header that use the "Basic Authentication Scheme" but using the "Proxy-Authorization" header instead. It will return a pair of username and password respectively.

void Cutelyst::Headers::pushRawHeader ( const QString &  field,
const QString &  value 
)
inline

This method directly inserts a Header in it's properly form which is field in upper case form with underscores instead of dashes, so 'Content-Type' becomes 'CONTENT_TYPE' like CGI does, this method should be used only by Engines to get faster performance and avoiding normalization.

Definition at line 294 of file headers.h.

QString Cutelyst::Headers::server ( ) const

Returns the server header field contains information about the software being used by the originating server program handling the request.

QString Cutelyst::Headers::setAuthorizationBasic ( const QString &  username,
const QString &  password 
)

This method is used to set an authorization header that use the "Basic Authentication Scheme". It won't set the values if username contains a colon ':'.

void Cutelyst::Headers::setContentLength ( qint64  value)

Defines the size in bytes of the message content

void Cutelyst::Headers::setContentType ( const QString &  contentType)

The Content-Type header field indicates the media type of the message content. E.g.: "text/html"

void Cutelyst::Headers::setContentTypeCharset ( const QString &  charset)

The Content-Type header field indicates the media type of the message content. this defines the charset of the content-type

QString Cutelyst::Headers::setDateWithDateTime ( const QDateTime &  date)

Defines the header that represents the date and time at which the message was originated

void Cutelyst::Headers::setHeader ( const QString &  field,
const QString &  value 
)

When setting a header always use setHeader instead of insert

void Cutelyst::Headers::setLastModified ( const QString &  value)

Defines the date and time at which the resource was last modified.

QString Cutelyst::Headers::setLastModified ( const QDateTime &  lastModified)

Defines the date and time at which the resource was last modified. This method takes a QDateTime and write it in RFC 822 and GMT timezone.

void Cutelyst::Headers::setProxyAuthenticate ( const QString &  value)

This header must be included in a 407 Proxy Authentication Required response.

void Cutelyst::Headers::setReferer ( const QString &  value)

Sets the referrer (Referer) header. This method removes the fragment from the given URI if it is present, as mandated by RFC2616. Note that the removal does not happen automatically if using the setHeader() method to set the referrer

void Cutelyst::Headers::setServer ( const QString &  value)

Defines the server header field contains information about the software being used by the originating server program handling the request.

void Cutelyst::Headers::setWwwAuthenticate ( const QString &  value)

This header must be included as part of a 401 Unauthorized response. The field value consist of a challenge that indicates the authentication scheme and parameters applicable to the requested URI.