wibble
1.1
|
#include <mime.h>
Public Member Functions | |
Reader () | |
bool | read_line (int sock, std::string &res) |
Read a line from the file descriptor. More... | |
bool | read_headers (int sock, std::map< std::string, std::string > &headers) |
Read MIME headers. More... | |
bool | read_until_boundary (int sock, const std::string &boundary, std::ostream &out, size_t max=0) |
Read until boundary is found, sending data to the given ostream. More... | |
bool | discard_until_boundary (int sock, const std::string &boundary) |
Read until boundary is found, sending data to the given ostream. More... | |
bool | readboundarytail (int sock) |
Skip until the end of the boundary line. More... | |
Public Attributes | |
wibble::ERegexp | header_splitter |
wibble::net::mime::Reader::Reader | ( | ) |
bool wibble::net::mime::Reader::discard_until_boundary | ( | int | sock, |
const std::string & | boundary | ||
) |
Read until boundary is found, sending data to the given ostream.
References wibble::list::count(), and readboundarytail().
Referenced by wibble::net::http::Params::parse_multipart().
bool wibble::net::mime::Reader::read_headers | ( | int | sock, |
std::map< std::string, std::string > & | headers | ||
) |
Read MIME headers.
References header_splitter, wibble::iterator(), wibble::Regexp::match(), read_line(), wibble::str::tolower(), and wibble::str::trim().
Referenced by wibble::net::http::Params::parse_multipart(), and wibble::net::http::Request::read_headers().
bool wibble::net::mime::Reader::read_line | ( | int | sock, |
std::string & | res | ||
) |
Read a line from the file descriptor.
The line is terminated by <CR><LF>. The line terminator is not included in the resulting string.
Note that if EOF is returned, res can still be filled with a partial line. This may happen if the connection ends after some data has been sent but before <CR><LF> is sent.
References wibble::list::count().
Referenced by read_headers(), and wibble::net::http::Request::read_method().
bool wibble::net::mime::Reader::read_until_boundary | ( | int | sock, |
const std::string & | boundary, | ||
std::ostream & | out, | ||
size_t | max = 0 |
||
) |
Read until boundary is found, sending data to the given ostream.
max | Maximum number of bytes to read, or 0 for unilimited until boundary |
References wibble::list::count(), and readboundarytail().
Referenced by wibble::net::http::Params::parse_multipart(), and wibble::net::http::FileParam::FileInfo::read().
bool wibble::net::mime::Reader::readboundarytail | ( | int | sock) |
Skip until the end of the boundary line.
References wibble::list::count().
Referenced by discard_until_boundary(), and read_until_boundary().
wibble::ERegexp wibble::net::mime::Reader::header_splitter |
Referenced by read_headers().