Got it compiling and somewhat working, except post.

This commit is contained in:
Brad Arant committed 2020-11-29 13:58:17 -08:00
1 parent 41852d019c
commit b6f4bf8a71
8 files changed
+69 -38

No files matched your search

+13 -15
View File
@@ -16,26 +16,24 @@ namespace coreutils {
bool IMFMessage::parse(PString &in) {
coreutils::Log(coreutils::LOG_DEBUG_4) << "parse [" << in.str() << "]";
if(in.str() != "") {
while (!in.ifNext("\r\n")) {
headers.emplace_back(in);
return true;
}
coreutils::Log(coreutils::LOG_DEBUG_2) << "End of header with Content Type = " << getHeader("Content-Type") << " for " << getHeader("Content-Length") << " bytes.";
std::string type = getHeader("Content-Type");
std::stringstream length(getHeader("Content-Length"));
int len = 0;
length >> len;
if(len > 0) {
PString block = in.readBlock(len);
if(type == "multipart/form-data")
body = new IMFMultipart(block, getHeaderKeyPairValue("Content-Type", "boundary"));
else if(type == "text/plain")
body = new IMFPlainText(in);
else
body = new IMFBody();
if(type.size() == 0)
type = "text/plain";
if(type == "multipart/form-data")
body = new IMFMultipart(in, getHeaderKeyPairValue("Content-Type", "boundary"));
else if(type == "text/plain")
body = new IMFPlainText(in);
else
body = new IMFBody();
}
return false;
}