Qore Mime Module Reference 1.4.4
Loading...
Searching...
No Matches
Mime::MultiPartFormDataMessage Class Reference

implements the MultiPartFormDataMessage class, a specialization of MultiPartMessage More...

#include <Mime.qm.dox.h>

Inheritance diagram for Mime::MultiPartFormDataMessage:
[legend]

Public Member Methods

 addPart (data mime_data, string name, *hash hdr)
 adds a message part to the end of the list More...
 
 addPart (data mime_data, string name, string filename, string content_type, *hash hdr)
 adds a message part to the end of the list More...
 
 addPart (hash< FormDataMessageInfo > h)
 adds a message part to the end of the list More...
 
 constructor (string boundary=MultiPartMessage::getBoundary())
 creates the object More...
 
hash< MessageInfogetMsgAndHeaders ()
 returns a hash of the message More...
 
 splicePart (data mime_data, string name, *hash hdr)
 adds a message part to the start of the list More...
 
 splicePart (data mime_data, string name, string filename, string content_type, *hash hdr)
 adds a message part to the start of the list More...
 
 splicePart (hash< FormDataMessageInfo > h)
 adds a message part to the start of the list More...
 
- Public Member Methods inherited from Mime::MultiPartMessage
 constructor (string mptype, string boundary=MultiPartMessage::getBoundary())
 creates the object More...
 
string getBoundary ()
 returns the message boundary string used More...
 
abstract hash< MessageInfogetMsgAndHeaders ()
 returns a hash of the message More...
 
binary serialize ()
 serializes the message with the Content-Type header first and returns a binary object ready to send over a socket
 
binary serializeBody ()
 serializes the message body only and returns a binary object ready to send over a socket More...
 
int size ()
 returns the number of parts in the message More...
 

Static Public Member Methods

static MultiPartFormDataMessage makeMessage (hash< string, hash< FormDataMessageInfo > > parts)
 creates a multipart/form-data message from a hash of FormDataMessageInfo hashes keyed by part name More...
 
static binary makeMessageBody (hash< string, hash< FormDataMessageInfo > > parts)
 creates a multipart/form-data message body from a hash of FormDataMessageInfo hashes keyed by part name More...
 
static hash< string, hash< FormDataMessageInfo > > parseMessage (string content, string body)
 parses a multipart/form-data encoded message and returns a hash of its ContentTransEnc7Bit More...
 
- Static Public Member Methods inherited from Mime::MultiPartMessage
static string getBoundary ()
 returns a string embedded with the current timestamp designed to be used as MultiPart boundary string
 
static string getRandomString (int len)
 returns a string of random characters More...
 
static hash< MessageInfoparseBody (string boundary, data body, bool decode=True)
 returns a hash representing a parsed multipart message body from a boundary string and body arguments More...
 
static binary serializeHeaders (hash hdr)
 serializes a header hash to a binary object More...
 

Private Member Methods

 checkPartName (string name)
 check for unique part names and adds the part to the unique name hash
 
hash getPartHeader (string name, *string filename, *string content_type, *hash hdr)
 builds the header for the part
 

Private Attributes

hash parts
 hash of part names to ensure uniqueness
 

Detailed Description

implements the MultiPartFormDataMessage class, a specialization of MultiPartMessage

Since
Mime 1.4

Member Function Documentation

◆ addPart() [1/3]

Mime::MultiPartFormDataMessage::addPart ( data  mime_data,
string  name,
*hash  hdr 
)

adds a message part to the end of the list

Parameters
mime_datathe data for the part
namethe unique name for the part
hdran optional hash of headers for the part
Exceptions
MULTIPART-FORMDATA-ERRORthe name parameter is empty or conflicts with an existing part name

◆ addPart() [2/3]

Mime::MultiPartFormDataMessage::addPart ( data  mime_data,
string  name,
string  filename,
string  content_type,
*hash  hdr 
)

adds a message part to the end of the list

Parameters
mime_datathe data for the part
namethe unique name for the part
filenamethe filename for the part
content_typethe content_type for the part
hdran optional hash of headers for the part
Exceptions
MULTIPART-FORMDATA-ERRORthe name parameter is empty or conflicts with an existing part name; empty filename or content_type arguments

◆ addPart() [3/3]

Mime::MultiPartFormDataMessage::addPart ( hash< FormDataMessageInfo h)

adds a message part to the end of the list

Parameters
hthe information for this part
Exceptions
MULTIPART-FORMDATA-ERRORthe name parameter is empty or conflicts with an existing part name; empty filename or content_type arguments

◆ constructor()

Mime::MultiPartFormDataMessage::constructor ( string  boundary = MultiPartMessage::getBoundary())

creates the object

Parameters
boundarythe boundary to use between parts

◆ getMsgAndHeaders()

hash< MessageInfo > Mime::MultiPartFormDataMessage::getMsgAndHeaders ( )
virtual

returns a hash of the message

Returns
a hash of the message with the following keys:
  • hdr: a hash of header information
  • body: a binary object of serialized message parts

Implements Mime::MultiPartMessage.

◆ makeMessage()

static MultiPartFormDataMessage Mime::MultiPartFormDataMessage::makeMessage ( hash< string, hash< FormDataMessageInfo > >  parts)
static

creates a multipart/form-data message from a hash of FormDataMessageInfo hashes keyed by part name

Parameters
partsa hash of FormDataMessageInfo hashes keyed by part name
Returns
the message object corresponding to the arguments

◆ makeMessageBody()

static binary Mime::MultiPartFormDataMessage::makeMessageBody ( hash< string, hash< FormDataMessageInfo > >  parts)
static

creates a multipart/form-data message body from a hash of FormDataMessageInfo hashes keyed by part name

Parameters
partsa hash of FormDataMessageInfo hashes keyed by part name
Returns
the serialized message body corresponding to the arguments

◆ parseMessage()

static hash< string, hash< FormDataMessageInfo > > Mime::MultiPartFormDataMessage::parseMessage ( string  content,
string  body 
)
static

parses a multipart/form-data encoded message and returns a hash of its ContentTransEnc7Bit

Parameters
contentthe message Content-Type string which must contain the message boundary string
bodythe message body to parse
Returns
a hash of FormDataMessageInfo hashes keyed by part name
Exceptions
MULTIPART-FORMDATA-MESSAGE-ERRORcannot find message boundary string; invalid form-data part data
Since
Mime 1.4

◆ splicePart() [1/3]

Mime::MultiPartFormDataMessage::splicePart ( data  mime_data,
string  name,
*hash  hdr 
)

adds a message part to the start of the list

Parameters
mime_datathe data for the part
namethe unique name for the part
hdran optional hash of headers for the part
Exceptions
MULTIPART-FORMDATA-ERRORthe name parameter is empty or conflicts with an existing part name

◆ splicePart() [2/3]

Mime::MultiPartFormDataMessage::splicePart ( data  mime_data,
string  name,
string  filename,
string  content_type,
*hash  hdr 
)

adds a message part to the start of the list

Parameters
mime_datathe data for the part
namethe unique name for the part
filenamethe filename for the part
content_typethe content_type for the part
hdran optional hash of headers for the part
Exceptions
MULTIPART-FORMDATA-ERRORthe name parameter is empty or conflicts with an existing part name; empty filename or content_type arguments

◆ splicePart() [3/3]

Mime::MultiPartFormDataMessage::splicePart ( hash< FormDataMessageInfo h)

adds a message part to the start of the list

Parameters
hthe information for this part
Exceptions
MULTIPART-FORMDATA-ERRORthe name parameter is empty or conflicts with an existing part name; empty filename or content_type arguments