]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Reduce diff to upstream yahttp, fixing a few CodeQL reports 9955/head
authorOtto <otto.moerbeek@open-xchange.com>
Tue, 12 Jan 2021 13:31:01 +0000 (14:31 +0100)
committerOtto <otto.moerbeek@open-xchange.com>
Tue, 12 Jan 2021 13:31:01 +0000 (14:31 +0100)
ext/yahttp/yahttp/cookie.hpp
ext/yahttp/yahttp/reqresp.hpp
ext/yahttp/yahttp/utility.hpp

index 90654cae5392ac364deac1718f56d4b33725fc7e..aa5359b1a720de3de1522fba0e3c9335fdadd02c 100644 (file)
@@ -75,7 +75,7 @@ namespace YaHTTP {
     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
index 1d310923a9c3a8f6c8e84d243e3ddc841545f90f..00ba545032bae0fed73a8f2940ff29d2046823e4 100644 (file)
@@ -96,7 +96,7 @@ namespace YaHTTP {
     };
 
     HTTPBase() {
-      initialize();
+      HTTPBase::initialize();
     };
 
     virtual void initialize() {
@@ -134,7 +134,7 @@ protected:
 #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;
@@ -196,16 +196,16 @@ public:
   /*! 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;
     }
@@ -225,16 +225,16 @@ public:
   /* 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;
     }
index 3e8920a1c9fa0b98ba07720c39312bb726b014d3..23e6b8a59dd5375fa2dceac686a437d8e0df53a8 100644 (file)
@@ -235,9 +235,9 @@ namespace YaHTTP {
            }
 
            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);