sync.
This commit is contained in:
parent
591705f897
commit
4f95b4591b
@ -8,10 +8,11 @@ namespace coreutils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
IMFHeader::IMFHeader(PString &in) {
|
IMFHeader::IMFHeader(PString &in) {
|
||||||
|
printf("in='%s'\n", in.str().c_str());
|
||||||
key = in.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-");
|
key = in.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-");
|
||||||
if(key.length() != 0) {
|
if(key.length() != 0) {
|
||||||
if(!in.ifNext(":")) {
|
if(!in.ifNext(":")) {
|
||||||
printf("%02X\n", in.str()[0]);
|
printf("key=%s %02X\n", key.c_str(), in.str()[0]);
|
||||||
throw coreutils::Exception("Invalid character in expected header token.");
|
throw coreutils::Exception("Invalid character in expected header token.");
|
||||||
}
|
}
|
||||||
in.skipWhitespace();
|
in.skipWhitespace();
|
||||||
|
@ -12,14 +12,16 @@ namespace coreutils {
|
|||||||
parse(in);
|
parse(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IMFMessage::parse(PString &in) {
|
bool IMFMessage::parse(PString &in) {
|
||||||
|
|
||||||
coreutils::Log(coreutils::LOG_DEBUG_4) << "parse [" << in.str() << "]";
|
coreutils::Log(coreutils::LOG_DEBUG_4) << "parse [" << in.str() << "]";
|
||||||
if(in.size() == 0)
|
|
||||||
return;
|
if(in.str() != "") {
|
||||||
|
|
||||||
while(!in.ifNext("\r\n") && !in.eod()) {
|
|
||||||
headers.emplace_back(in);
|
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::string type = getHeader("Content-Type");
|
||||||
|
|
||||||
@ -32,6 +34,7 @@ namespace coreutils {
|
|||||||
body = new IMFPlainText(in);
|
body = new IMFPlainText(in);
|
||||||
else
|
else
|
||||||
body = new IMFBody();
|
body = new IMFBody();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IMFMessage::output(std::stringstream &out) {
|
void IMFMessage::output(std::stringstream &out) {
|
||||||
|
@ -14,7 +14,7 @@ namespace coreutils {
|
|||||||
IMFMessage();
|
IMFMessage();
|
||||||
IMFMessage(PString &in);
|
IMFMessage(PString &in);
|
||||||
|
|
||||||
void parse(PString &in);
|
bool parse(PString &in);
|
||||||
|
|
||||||
void output(std::stringstream &out);
|
void output(std::stringstream &out);
|
||||||
IMFRequest *request;
|
IMFRequest *request;
|
||||||
|
@ -77,9 +77,11 @@ namespace coreutils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int PString::skipWhitespace() {
|
int PString::skipWhitespace() {
|
||||||
size_t found = pstring.find_first_not_of(" \t", cursor);
|
size_t temp = cursor;
|
||||||
coreutils::Log(coreutils::LOG_DEBUG_2) << "Skipping whitespace for " << found << " spaces.";
|
cursor = pstring.find_first_not_of(" \t", cursor);
|
||||||
return found;
|
cursor = cursor == -1 ? temp: cursor;
|
||||||
|
coreutils::Log(coreutils::LOG_DEBUG_2) << "Skipping whitespace for " << (cursor - temp) << " spaces.";
|
||||||
|
return cursor - temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PString::size() {
|
int PString::size() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user