diff --git a/http_client.cpp b/http_client.cpp index 93d595f..5dad271 100644 --- a/http_client.cpp +++ b/http_client.cpp @@ -455,7 +455,7 @@ void Response::parseStatus() { if (cstr_stricmp(parts[0].c_str(), "http/1.1")) { throw std::runtime_error("Unspported HTTP version"); } - if (sscanf(parts[1].c_str(), "%" SCNu8, &this->code) != 1) { + if (sscanf(parts[1].c_str(), "%" SCNu16, &this->code) != 1) { throw std::runtime_error("Invalid HTTP status code"); } this->reason = parts[2]; diff --git a/http_client.h b/http_client.h index 58ea189..e02f3b9 100644 --- a/http_client.h +++ b/http_client.h @@ -151,7 +151,7 @@ public: Response() = delete; explicit Response(Socket socket); HeaderMap headers; - uint8_t code = 0; + uint16_t code = 0; std::string reason; std::string read(); std::string readAll();