Add more http status code

This commit is contained in:
Ilan Pegoraro
2016-10-28 16:51:37 +01:00
parent f454b0be7e
commit 79da42f0b9
2 changed files with 19 additions and 1 deletions

View File

@@ -139,6 +139,10 @@ public:
enum {
/// Request was successful
OK = 200,
/// Request was successful and a resource was created
Created = 201,
/// Request was accepted for processing, not completed yet.
Accepted = 202,
/// Range request was successful
PartialContent = 206,
/// Resource has moved permanently
@@ -155,8 +159,16 @@ public:
NotFound = 404,
/// Method is not valid for the resource
MethodNotAllowed = 405,
/// The request could not be completed due to a conflict with the current state of the resource
Conflict = 409,
/// An internal server error occurred
InternalServerError = 500
InternalServerError = 500,
/// Invalid response from server while acting as a gateway
BadGateway = 502,
/// Server unable to handle request due to overload
ServiceUnavailable = 503,
/// Server does not supports the HTTP version in the request
HttpVersionNotSupported = 505
};
/**

View File

@@ -75,6 +75,8 @@ QByteArray QHttpSocketPrivate::statusReason(int statusCode) const
{
switch (statusCode) {
case QHttpSocket::OK: return "OK";
case QHttpSocket::Created: return "CREATED";
case QHttpSocket::Accepted: return "ACCEPTED";
case QHttpSocket::PartialContent: return "PARTIAL CONTENT";
case QHttpSocket::MovedPermanently: return "MOVED PERMANENTLY";
case QHttpSocket::Found: return "FOUND";
@@ -83,7 +85,11 @@ QByteArray QHttpSocketPrivate::statusReason(int statusCode) const
case QHttpSocket::Forbidden: return "FORBIDDEN";
case QHttpSocket::NotFound: return "NOT FOUND";
case QHttpSocket::MethodNotAllowed: return "METHOD NOT ALLOWED";
case QHttpSocket::Conflict: return "CONFLICT";
case QHttpSocket::BadGateway: return "BAD GATEWAY";
case QHttpSocket::ServiceUnavailable: return "SERVICE UNAVAILABLE";
case QHttpSocket::InternalServerError: return "INTERNAL SERVER ERROR";
case QHttpSocket::HttpVersionNotSupported: return "HTTP VERSION NOT SUPPORTED";
default: return "UNKNOWN ERROR";
}
}