From 6e2629d85bfe8d2a5912685aa367c96c8740f354 Mon Sep 17 00:00:00 2001 From: Otto Date: Tue, 12 Jan 2021 14:31:01 +0100 Subject: [PATCH] Reduce diff to upstream yahttp, fixing a few CodeQL reports --- ext/yahttp/yahttp/cookie.hpp | 2 +- ext/yahttp/yahttp/reqresp.hpp | 16 ++++++++-------- ext/yahttp/yahttp/utility.hpp | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ext/yahttp/yahttp/cookie.hpp b/ext/yahttp/yahttp/cookie.hpp index 90654cae53..aa5359b1a7 100644 --- a/ext/yahttp/yahttp/cookie.hpp +++ b/ext/yahttp/yahttp/cookie.hpp @@ -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()); } //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; } diff --git a/ext/yahttp/yahttp/utility.hpp b/ext/yahttp/yahttp/utility.hpp index 3e8920a1c9..23e6b8a59d 100644 --- a/ext/yahttp/yahttp/utility.hpp +++ b/ext/yahttp/yahttp/utility.hpp @@ -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); -- 2.47.2