Latest updates.

This commit is contained in:
Brad Arant 2021-08-26 22:57:47 -07:00
parent c10b760903
commit deb88cb14d
5 changed files with 12 additions and 12 deletions

View File

@ -11,17 +11,17 @@ namespace coreutils {
IMFMessage::IMFMessage(ZString &in) : ZString(in) { IMFMessage::IMFMessage(ZString &in) : ZString(in) {
while (!in.ifNext((char *)"\r\n")) { while (!in.ifNext("\r\n")) {
headers.emplace_back(in); headers.emplace_back(in);
} }
ZString type = getHeader((char *)"Content-Type"); ZString type = getHeader("Content-Type");
int len = getHeader((char *)"Content-Length").asInteger(); int len = getHeader("Content-Length").asInteger();
if(len > 0) { if(len > 0) {
ZString block = in.readBlock(len); ZString block = in.readBlock(len);
if(type.equals((char *)"multipart/form-data")) if(type.equals("multipart/form-data"))
body = new IMFMultipart(block, getHeaderKeyPairValue((char *)"Content-Type", (char *)"boundary")); body = new IMFMultipart(block, getHeaderKeyPairValue("Content-Type", "boundary"));
else if(type.equals((char *)"text/plain")) else if(type.equals("text/plain"))
body = new IMFPlainText(block); body = new IMFPlainText(block);
else else
body = new IMFBody(block); body = new IMFBody(block);

View File

@ -4,9 +4,9 @@
namespace coreutils { namespace coreutils {
IMFRequest::IMFRequest(ZString &in) : IMFMessage(in) { IMFRequest::IMFRequest(ZString &in) : ZString(in) {
setZString(in.goeol()); in.goeol();
this->split((char *)" "); this->split(" ", 3);
} }
ZString IMFRequest::getMethod() { ZString IMFRequest::getMethod() {

View File

@ -6,7 +6,7 @@
namespace coreutils { namespace coreutils {
class IMFRequest : public IMFMessage { class IMFRequest : ZString {
public: public:
IMFRequest(ZString &in); IMFRequest(ZString &in);

View File

@ -128,7 +128,7 @@ namespace coreutils {
return string == std::string(data, length); return string == std::string(data, length);
} }
bool ZString::ifNext(char *value) { bool ZString::ifNext(const char *value) {
bool test = (strncmp(cursor, value, strlen(value)) == 0); bool test = (strncmp(cursor, value, strlen(value)) == 0);
if(test) if(test)
cursor += strlen(value); cursor += strlen(value);

View File

@ -151,7 +151,7 @@ namespace coreutils {
/// the cursor position is equal to the value provided. /// the cursor position is equal to the value provided.
/// ///
bool ifNext(char *value); bool ifNext(const char *value);
/// ///
/// Advance the cursor through the ZString for each whitespace character /// Advance the cursor through the ZString for each whitespace character