Public Member Functions | |
Impl () | |
void | reset () |
bool | parseIndex (std::istream &istr, S32 limit, const std::string &separator, bool is_subpart, LLMimeIndex &index) |
Parse a mime entity to find the index information. | |
Protected Types | |
LINE_BUFFER_LENGTH = 1024 | |
enum | { LINE_BUFFER_LENGTH = 1024 } |
Protected Member Functions | |
bool | parseHeaders (std::istream &istr, S32 limit, LLSD &headers) |
parse the headers. | |
std::string | findSeparator (std::string multipart_content_type) |
Figure out the separator string from a content type header. | |
void | scanPastSeparator (std::istream &istr, S32 limit, const std::string &separator) |
Scan through istr past the separator. | |
void | scanPastContent (std::istream &istr, S32 limit, LLSD headers, const std::string separator) |
Scan through istr past the content of the current mime part. | |
bool | eatCRLF (std::istream &istr) |
Eat CRLF. | |
bool | continueParse () const |
Protected Attributes | |
S32 | mScanCount |
bool | mContinue |
bool | mError |
char | mBuffer [LINE_BUFFER_LENGTH] |
Definition at line 228 of file llmime.cpp.
anonymous enum [protected] |
LLMimeParser::Impl::Impl | ( | ) |
bool LLMimeParser::Impl::continueParse | ( | ) | const [inline, protected] |
Definition at line 317 of file llmime.cpp.
References mContinue, and mError.
Referenced by parseHeaders(), parseIndex(), and scanPastSeparator().
bool LLMimeParser::Impl::eatCRLF | ( | std::istream & | istr | ) | [protected] |
Eat CRLF.
This method has no concept of the limit, so ensure you have at least 2 characters left to eat before hitting the limit. This method will increment mScanCount as it goes.
istr | The input stream. |
Definition at line 564 of file llmime.cpp.
References c, and mScanCount.
Referenced by scanPastContent().
std::string LLMimeParser::Impl::findSeparator | ( | std::string | multipart_content_type | ) | [protected] |
Figure out the separator string from a content type header.
multipart_content_type | The content type value from the headers. |
Definition at line 456 of file llmime.cpp.
References BOUNDARY(), end, END_OF_CONTENT_PARAMETER(), and mError.
Referenced by parseIndex().
bool LLMimeParser::Impl::parseHeaders | ( | std::istream & | istr, | |
S32 | limit, | |||
LLSD & | headers | |||
) | [protected] |
parse the headers.
At the end of a successful parse, mScanCount will be at the start of the content.
istr | The input stream. | |
limit | maximum number of bytes to process | |
headers[out] | A map of the headers found. |
Definition at line 384 of file llmime.cpp.
References c, LLStringBase< char >::compareInsensitive(), continueParse(), LLSD::isUndefined(), KNOWN_HEADER, KNOWN_HEADER_COUNT, LINE_BUFFER_LENGTH, llmin(), mBuffer, mContinue, mError, mScanCount, and S32.
Referenced by parseIndex().
bool LLMimeParser::Impl::parseIndex | ( | std::istream & | istr, | |
S32 | limit, | |||
const std::string & | separator, | |||
bool | is_subpart, | |||
LLMimeIndex & | index | |||
) |
Parse a mime entity to find the index information.
This method will scan the istr until a single complete mime entity is read, an EOF, or limit bytes have been scanned. The istr will be modified by this parsing, so pass in a temporary stream or rewind/reset the stream after this call.
istr | An istream which contains a mime entity. | |
limit | The maximum number of bytes to scan. | |
separator | The multipart separator if it is known. | |
is_subpart | Set true if parsing a multipart sub part. | |
index[out] | The parsed output. |
Definition at line 345 of file llmime.cpp.
References LLMimeIndex::attachSubPart(), CONTENT_TYPE(), continueParse(), findSeparator(), LLMimeIndex::isMultipart(), mError, mScanCount, parseHeaders(), scanPastContent(), and scanPastSeparator().
Referenced by LLMimeParser::parseIndex().
void LLMimeParser::Impl::reset | ( | ) |
Definition at line 337 of file llmime.cpp.
References mBuffer, mContinue, mError, and mScanCount.
Referenced by Impl(), and LLMimeParser::reset().
void LLMimeParser::Impl::scanPastContent | ( | std::istream & | istr, | |
S32 | limit, | |||
LLSD | headers, | |||
const std::string | separator | |||
) | [protected] |
Scan through istr past the content of the current mime part.
istr | The input stream. | |
limit | Maximum number of bytes to scan. | |
headers | The headers for this mime part. | |
separator | The multipart separator if known. |
Definition at line 535 of file llmime.cpp.
References CONTENT_LENGTH(), eatCRLF(), LLSD::has(), llmin(), mContinue, mError, mScanCount, and S32.
Referenced by parseIndex().
void LLMimeParser::Impl::scanPastSeparator | ( | std::istream & | istr, | |
S32 | limit, | |||
const std::string & | separator | |||
) | [protected] |
Scan through istr past the separator.
istr | The input stream. | |
limit | Maximum number of bytes to scan. | |
separator | The multipart separator. |
Definition at line 491 of file llmime.cpp.
References c, LLStringBase< char >::compareStrings(), continueParse(), LINE_BUFFER_LENGTH, llmin(), mBuffer, mContinue, mError, mScanCount, S32, and SEPARATOR_PREFIX().
Referenced by parseIndex().
char LLMimeParser::Impl::mBuffer[LINE_BUFFER_LENGTH] [protected] |
Definition at line 329 of file llmime.cpp.
Referenced by parseHeaders(), reset(), and scanPastSeparator().
bool LLMimeParser::Impl::mContinue [protected] |
Definition at line 327 of file llmime.cpp.
Referenced by continueParse(), parseHeaders(), reset(), scanPastContent(), and scanPastSeparator().
bool LLMimeParser::Impl::mError [protected] |
Definition at line 328 of file llmime.cpp.
Referenced by continueParse(), findSeparator(), parseHeaders(), parseIndex(), reset(), scanPastContent(), and scanPastSeparator().
S32 LLMimeParser::Impl::mScanCount [protected] |
Definition at line 326 of file llmime.cpp.
Referenced by eatCRLF(), parseHeaders(), parseIndex(), reset(), scanPastContent(), and scanPastSeparator().