Into

Modules

Documentation

classPiiMimeHeader

#include <PiiMimeHeader.h>

A class that stores header information for multipart messages as defined in RFC 1341, 2045, and 2387.

Inherits QHttpHeader

Description

PiiMimeHeader eases parsing of such headers by providing some useful functions for querying values commonly used. Note that the default Content-Type for a multipart message is text/plain.

Constructors and destructor

( )

Copy another header.

( )

Copy another header.

Create an empty (invalid) header.

( )

Parse a string containing header information.

Public member functions

( )

Returns the boundary string that separates entities in this multipart message.

Get the value of the Content-Disposition header, without parameters.

Get the name of the HTML form control that sent the following entity.

( )

Returns the name of an uploaded file, if the entity is a file uploaded from an HTML form.

bool

See if the header describes a multipart message.

bool

See if the header describes a file uploaded from a HTML form.

int
int
( )

Copy another header.

( )

Returns the "preamble" of a multipart message, if there is one.

void
( )

Sets the preamble.

Static public member functions

static QByteArray
(
  • QIODevice * device
  • qint64 maxLength
  • qint64 * bytesRead = 0
)

Reads a MIME header from device.

Function details

  • PiiMimeHeader

    ( )

    Copy another header.

  • PiiMimeHeader

    ( )

    Copy another header.

  • PiiMimeHeader

    ()

    Create an empty (invalid) header.

  • PiiMimeHeader

    ( )

    Parse a string containing header information.

    If the string is not correctly formatted, the header will become invalid.

  • ~PiiMimeHeader

    ()
  • QString boundary

    ()

    Returns the boundary string that separates entities in this multipart message.

    If this header does not represent a multipart message, an empty string will be returned.

  • QString contentDisposition

    ()

    Get the value of the Content-Disposition header, without parameters.

     // Content-Disposition: form-data; name=control
     QString disposition = header.contentDisposition(); // returns "form-data"
    
  • QString controlName

    ()

    Get the name of the HTML form control that sent the following entity.

    If the header does not contain such information, an empty string will be returned.

     // Content-Disposition: form-data; name=control
     QString name = header.controlName(); // returns "control"
    
  • QString fileName

    ()

    Returns the name of an uploaded file, if the entity is a file uploaded from an HTML form.

    If there is no file name, an empty string will be returned.

  • bool isMultipart

    ()

    See if the header describes a multipart message.

    The Content-Type header field of a multipart message begins with multipart/. The body of a multipart message consists of many entities.

  • bool isUploadedFile

    ()

    See if the header describes a file uploaded from a HTML form.

    Browsers use multipart/form-data encoding to send files from HTML forms. If the Content-Disposition header contains a file name, the entity can be treated as an uploaded file. Use the fileName() function to get the name of the file.

  • int majorVersion

    ()
  • int minorVersion

    ()
  • PiiMimeHeader & operator=

    ( )

    Copy another header.

  • QByteArray preamble

    ()

    Returns the "preamble" of a multipart message, if there is one.

    The preamble can be used to transfer additional information that is not part of the entity itself.

  • void setPreamble

    ( )

    Sets the preamble.

  • static QByteArray readHeaderData

    (
    • QIODevice * device
    • qint64 maxLength
    • qint64 * bytesRead = 0
    )
    [static]

    Reads a MIME header from device.

    This functions reads lines from device until an empty line is found.

    Parameters
    device

    the input device

    maxLength

    the maximum number of bytes to read

    bytesRead

    a return-value parameter that stores the number of bytes actually read from device. Note that this value may be different from the size of the returned array.

    Returns

    header data as a byte array, excluding the empty line at the end.

Notes (0)

Add a note

Not a single note added yet. Be the first, add yours.