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) {
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);

View File

@ -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() {

View File

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

View File

@ -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);

View File

@ -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