Added vscode
This commit is contained in:
parent
6894968732
commit
c00476719c
26
.vscode/tasks.json
vendored
Normal file
26
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "g++ build active file",
|
||||||
|
"command": "/usr/bin/g++",
|
||||||
|
"args": [
|
||||||
|
"-g",
|
||||||
|
"${file}",
|
||||||
|
"-o",
|
||||||
|
"${fileDirname}"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"cwd": "/home/barant/Development/HTTPServer/"
|
||||||
|
},
|
||||||
|
"problemMatcher": [
|
||||||
|
"$gcc"
|
||||||
|
],
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -6,10 +6,12 @@
|
|||||||
|
|
||||||
namespace coreutils {
|
namespace coreutils {
|
||||||
|
|
||||||
IMFMessage::IMFMessage() {}
|
IMFMessage::IMFMessage() {
|
||||||
|
|
||||||
IMFMessage::IMFMessage(PString &in) {
|
|
||||||
body = NULL;
|
body = NULL;
|
||||||
|
first = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
IMFMessage::IMFMessage(PString &in) : IMFMessage() {
|
||||||
parse(in);
|
parse(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,6 +19,14 @@ namespace coreutils {
|
|||||||
|
|
||||||
coreutils::Log(coreutils::LOG_DEBUG_4) << "parse [" << in.str() << "]";
|
coreutils::Log(coreutils::LOG_DEBUG_4) << "parse [" << in.str() << "]";
|
||||||
|
|
||||||
|
if(first) {
|
||||||
|
if(in.str().find(" ") != std::string::npos) {
|
||||||
|
parse(in);
|
||||||
|
first = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(in.str() != "") {
|
if(in.str() != "") {
|
||||||
headers.emplace_back(in);
|
headers.emplace_back(in);
|
||||||
return true;
|
return true;
|
||||||
|
@ -17,7 +17,6 @@ namespace coreutils {
|
|||||||
bool parse(PString &in);
|
bool parse(PString &in);
|
||||||
|
|
||||||
void output(std::stringstream &out);
|
void output(std::stringstream &out);
|
||||||
IMFRequest *request;
|
|
||||||
|
|
||||||
void addHeader(std::string key, std::string value);
|
void addHeader(std::string key, std::string value);
|
||||||
|
|
||||||
@ -27,9 +26,13 @@ namespace coreutils {
|
|||||||
IMFBody *getBody();
|
IMFBody *getBody();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
IMFRequest request;
|
||||||
std::vector<IMFHeader> headers;
|
std::vector<IMFHeader> headers;
|
||||||
IMFBody *body;
|
IMFBody *body;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool first = true;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,42 +7,33 @@ namespace coreutils {
|
|||||||
IMFRequest::IMFRequest() {}
|
IMFRequest::IMFRequest() {}
|
||||||
|
|
||||||
IMFRequest::IMFRequest(PString &in) {
|
IMFRequest::IMFRequest(PString &in) {
|
||||||
method = in.getTokenExclude(" ");
|
parse(in);
|
||||||
if(!in.ifNext(" "))
|
}
|
||||||
throw coreutils::Exception("Expecting space after method.");
|
|
||||||
uri = in.getTokenExclude(" ");
|
|
||||||
if(!in.ifNext(" "))
|
|
||||||
throw coreutils::Exception("Expecting space after URI.");
|
|
||||||
protocol = in.str();
|
|
||||||
|
|
||||||
|
bool IMFRequest::parse(PString &in) {
|
||||||
|
parts = in.split(" ");
|
||||||
|
return parts.size() == 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string IMFRequest::getMethod() {
|
std::string IMFRequest::getMethod() {
|
||||||
return method;
|
if(parts.size() == 3)
|
||||||
}
|
return parts[0].str();
|
||||||
|
else
|
||||||
void IMFRequest::setMethod(std::string method) {
|
return NULL;
|
||||||
this->method = method;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string IMFRequest::getURI() {
|
std::string IMFRequest::getURI() {
|
||||||
return uri;
|
if(parts.size() == 3)
|
||||||
}
|
return parts[1].str();
|
||||||
|
else
|
||||||
void IMFRequest::setURI(std::string uri) {
|
return NULL;
|
||||||
this->uri = uri;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string IMFRequest::getProtocol() {
|
std::string IMFRequest::getProtocol() {
|
||||||
return protocol;
|
if(parts.size() == 3)
|
||||||
}
|
return parts[2].str();
|
||||||
|
else
|
||||||
void IMFRequest::setProtocol(std::string protocol) {
|
return NULL;
|
||||||
this->protocol = protocol;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IMFRequest::output(std::stringstream &out) {
|
|
||||||
out << method << " " << uri << " " << protocol << "\r\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
15
IMFRequest.h
15
IMFRequest.h
@ -11,19 +11,14 @@ namespace coreutils {
|
|||||||
IMFRequest();
|
IMFRequest();
|
||||||
IMFRequest(PString &in);
|
IMFRequest(PString &in);
|
||||||
|
|
||||||
std::string getMethod();
|
bool parse(PString &in);
|
||||||
void setMethod(std::string method);
|
|
||||||
std::string getURI();
|
|
||||||
void setURI(std::string uri);
|
|
||||||
std::string getProtocol();
|
|
||||||
void setProtocol(std::string protocol);
|
|
||||||
|
|
||||||
void output(std::stringstream &out);
|
std::string getMethod();
|
||||||
|
std::string getURI();
|
||||||
|
std::string getProtocol();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string method;
|
std::vector<PString> parts;
|
||||||
std::string uri;
|
|
||||||
std::string protocol;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user