From deb88cb14d234ddd27c8a73f34c1c69a9c459287 Mon Sep 17 00:00:00 2001 From: Brad Arant Date: Thu, 26 Aug 2021 22:57:47 -0700 Subject: [PATCH] Latest updates. --- IMFMessage.cpp | 12 ++++++------ IMFRequest.cpp | 6 +++--- IMFRequest.h | 2 +- ZString.cpp | 2 +- ZString.h | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/IMFMessage.cpp b/IMFMessage.cpp index 1c2202b..8675800 100644 --- a/IMFMessage.cpp +++ b/IMFMessage.cpp @@ -11,17 +11,17 @@ namespace coreutils { IMFMessage::IMFMessage(ZString &in) : ZString(in) { - while (!in.ifNext((char *)"\r\n")) { + while (!in.ifNext("\r\n")) { headers.emplace_back(in); } - ZString type = getHeader((char *)"Content-Type"); - int len = getHeader((char *)"Content-Length").asInteger(); + ZString type = getHeader("Content-Type"); + int len = getHeader("Content-Length").asInteger(); if(len > 0) { ZString block = in.readBlock(len); - if(type.equals((char *)"multipart/form-data")) - body = new IMFMultipart(block, getHeaderKeyPairValue((char *)"Content-Type", (char *)"boundary")); - else if(type.equals((char *)"text/plain")) + if(type.equals("multipart/form-data")) + body = new IMFMultipart(block, getHeaderKeyPairValue("Content-Type", "boundary")); + else if(type.equals("text/plain")) body = new IMFPlainText(block); else body = new IMFBody(block); diff --git a/IMFRequest.cpp b/IMFRequest.cpp index fd11904..3b73661 100644 --- a/IMFRequest.cpp +++ b/IMFRequest.cpp @@ -4,9 +4,9 @@ namespace coreutils { - IMFRequest::IMFRequest(ZString &in) : IMFMessage(in) { - setZString(in.goeol()); - this->split((char *)" "); + IMFRequest::IMFRequest(ZString &in) : ZString(in) { + in.goeol(); + this->split(" ", 3); } ZString IMFRequest::getMethod() { diff --git a/IMFRequest.h b/IMFRequest.h index 9003386..c64c548 100644 --- a/IMFRequest.h +++ b/IMFRequest.h @@ -6,7 +6,7 @@ namespace coreutils { - class IMFRequest : public IMFMessage { + class IMFRequest : ZString { public: IMFRequest(ZString &in); diff --git a/ZString.cpp b/ZString.cpp index 210556a..1454daa 100644 --- a/ZString.cpp +++ b/ZString.cpp @@ -128,7 +128,7 @@ namespace coreutils { 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); if(test) cursor += strlen(value); diff --git a/ZString.h b/ZString.h index 1173df2..85bb20b 100644 --- a/ZString.h +++ b/ZString.h @@ -151,7 +151,7 @@ namespace coreutils { /// 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