void keyValuePair(const std::string &keyvalue, std::string &key, std::string &value) {
size_t pos;
pos = keyvalue.find("=");
- if (pos == std::string::npos) throw "Not a Key-Value pair (cookie)";
+ if (pos == std::string::npos) throw ParseError("Not a Key-Value pair (cookie)");
key = std::string(keyvalue.begin(), keyvalue.begin()+pos);
value = std::string(keyvalue.begin()+pos+1, keyvalue.end());
} //<! key value pair parser
};
HTTPBase() {
- initialize();
+ HTTPBase::initialize();
};
virtual void initialize() {
#endif
this->is_multipart = rhs.is_multipart;
};
- HTTPBase& operator=(const HTTPBase& rhs) {
+ virtual HTTPBase& operator=(const HTTPBase& rhs) {
this->url = rhs.url; this->kind = rhs.kind;
this->status = rhs.status; this->statusText = rhs.statusText;
this->method = rhs.method; this->headers = rhs.headers;
/*! Response class, represents a HTTP Response document */
class Response: public HTTPBase {
public:
- Response() { initialize(); };
+ Response() { Response::initialize(); };
Response(const HTTPBase& rhs): HTTPBase(rhs) {
this->kind = YAHTTP_TYPE_RESPONSE;
};
- Response& operator=(const HTTPBase& rhs) {
+ Response& operator=(const HTTPBase& rhs) override {
HTTPBase::operator=(rhs);
this->kind = YAHTTP_TYPE_RESPONSE;
return *this;
};
- void initialize() {
+ void initialize() override {
HTTPBase::initialize();
this->kind = YAHTTP_TYPE_RESPONSE;
}
/* Request class, represents a HTTP Request document */
class Request: public HTTPBase {
public:
- Request() { initialize(); };
+ Request() { Request::initialize(); };
Request(const HTTPBase& rhs): HTTPBase(rhs) {
this->kind = YAHTTP_TYPE_REQUEST;
};
- Request& operator=(const HTTPBase& rhs) {
+ Request& operator=(const HTTPBase& rhs) override {
HTTPBase::operator=(rhs);
this->kind = YAHTTP_TYPE_REQUEST;
return *this;
};
- void initialize() {
+ void initialize() override {
HTTPBase::initialize();
this->kind = YAHTTP_TYPE_REQUEST;
}
}
if ('0' <= a && a <= '9') a = a - '0';
- if ('a' <= a && a <= 'f') a = a - 'a' + 0x0a;
+ else if ('a' <= a && a <= 'f') a = a - 'a' + 0x0a;
if ('0' <= b && b <= '9') b = b - '0';
- if ('a' <= b && b <= 'f') b = b - 'a' + 0x0a;
+ else if ('a' <= b && b <= 'f') b = b - 'a' + 0x0a;
c = (a<<4)+b;
result = result.replace(pos1,3,1,c);