More development on the messaging.
This commit is contained in:
parent
f4496fc682
commit
591705f897
@ -13,7 +13,7 @@ namespace coreutils {
|
||||
}
|
||||
|
||||
void IMFMessage::parse(PString &in) {
|
||||
coreutils::Log(coreutils::LOG_DEBUG_4) << "[" << in.str() << "]";
|
||||
coreutils::Log(coreutils::LOG_DEBUG_4) << "parse [" << in.str() << "]";
|
||||
if(in.size() == 0)
|
||||
return;
|
||||
|
||||
|
12
IMFMessage.h
12
IMFMessage.h
@ -9,22 +9,22 @@
|
||||
namespace coreutils {
|
||||
|
||||
class IMFMessage {
|
||||
|
||||
|
||||
public:
|
||||
IMFMessage();
|
||||
IMFMessage(PString &in);
|
||||
|
||||
|
||||
void parse(PString &in);
|
||||
|
||||
void output(std::stringstream &out);
|
||||
IMFRequest *request;
|
||||
|
||||
|
||||
void addHeader(std::string key, std::string value);
|
||||
|
||||
|
||||
std::string getHeader(std::string key, bool valueOnly = true);
|
||||
std::string getHeaderKeyPairValue(std::string headerKey, std::string key);
|
||||
|
||||
IMFBody *getBody();
|
||||
|
||||
IMFBody *getBody();
|
||||
|
||||
protected:
|
||||
std::vector<IMFHeader> headers;
|
||||
|
@ -13,12 +13,8 @@ namespace coreutils {
|
||||
uri = in.getTokenExclude(" ");
|
||||
if(!in.ifNext(" "))
|
||||
throw coreutils::Exception("Expecting space after URI.");
|
||||
protocol = in.getTokenExclude("\r");
|
||||
protocol = in.str();
|
||||
|
||||
coreutils::Log(coreutils::LOG_DEBUG_4) << "[" << in.str() << "]";
|
||||
|
||||
if(!in.ifNext("\r"))
|
||||
throw coreutils::Exception("Expecting CRLF after protocol.");
|
||||
}
|
||||
|
||||
std::string IMFRequest::getMethod() {
|
||||
|
@ -31,7 +31,7 @@ namespace coreutils {
|
||||
|
||||
while(pos < pstring.length()) {
|
||||
end = pstring.find(delimiter, pos);
|
||||
if(end == std::string::npos)
|
||||
if(end == -1)
|
||||
end = pstring.length();
|
||||
list.push_back(PString(pstring.substr(pos, end - pos)));
|
||||
pos = end + delimiter.size();
|
||||
@ -78,7 +78,8 @@ namespace coreutils {
|
||||
|
||||
int PString::skipWhitespace() {
|
||||
size_t found = pstring.find_first_not_of(" \t", cursor);
|
||||
return found != cursor::npos ? cursor + found: 0;
|
||||
coreutils::Log(coreutils::LOG_DEBUG_2) << "Skipping whitespace for " << found << " spaces.";
|
||||
return found;
|
||||
}
|
||||
|
||||
int PString::size() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user