mirror of
https://github.com/lifegpc/c-utils.git
synced 2026-07-08 01:30:39 +08:00
Update HTTP status code data type
This commit is contained in:
@@ -455,7 +455,7 @@ void Response::parseStatus() {
|
|||||||
if (cstr_stricmp(parts[0].c_str(), "http/1.1")) {
|
if (cstr_stricmp(parts[0].c_str(), "http/1.1")) {
|
||||||
throw std::runtime_error("Unspported HTTP version");
|
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");
|
throw std::runtime_error("Invalid HTTP status code");
|
||||||
}
|
}
|
||||||
this->reason = parts[2];
|
this->reason = parts[2];
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ public:
|
|||||||
Response() = delete;
|
Response() = delete;
|
||||||
explicit Response(Socket socket);
|
explicit Response(Socket socket);
|
||||||
HeaderMap headers;
|
HeaderMap headers;
|
||||||
uint8_t code = 0;
|
uint16_t code = 0;
|
||||||
std::string reason;
|
std::string reason;
|
||||||
std::string read();
|
std::string read();
|
||||||
std::string readAll();
|
std::string readAll();
|
||||||
|
|||||||
Reference in New Issue
Block a user