Add BAD_USER_AGENT sdk status code Return BAD_USER_AGENT sdk status code in response to each HTTP request, returning HTTP_NOT_ACCEPTABLE(406).
Project: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-core/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-core/commit/e6825711 Tree: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-core/tree/e6825711 Diff: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-core/diff/e6825711 Branch: refs/heads/master Commit: e6825711ab78d6220cccf5eaff92c016caf15b8a Parents: a17c6b3 Author: Slav Klenov <[email protected]> Authored: Fri Sep 2 12:11:20 2016 +0300 Committer: Slav Klenov <[email protected]> Committed: Fri Sep 2 14:39:53 2016 +0300 ---------------------------------------------------------------------- src/mpin_sdk.cpp | 9 ++++++++- src/mpin_sdk.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-core/blob/e6825711/src/mpin_sdk.cpp ---------------------------------------------------------------------- diff --git a/src/mpin_sdk.cpp b/src/mpin_sdk.cpp index 5cfe7a4..d438156 100644 --- a/src/mpin_sdk.cpp +++ b/src/mpin_sdk.cpp @@ -401,7 +401,14 @@ void MPinSDK::HttpResponse::SetHttpError(int httpStatus) } else if(httpStatus >= 400) { - m_mpinStatus.SetStatusCode(Status::HTTP_REQUEST_ERROR); + if (httpStatus == HTTP_NOT_ACCEPTABLE) + { + m_mpinStatus.SetStatusCode(Status::BAD_USER_AGENT); + } + else + { + m_mpinStatus.SetStatusCode(Status::HTTP_REQUEST_ERROR); + } } else if(httpStatus >= 300) { http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-core/blob/e6825711/src/mpin_sdk.h ---------------------------------------------------------------------- diff --git a/src/mpin_sdk.h b/src/mpin_sdk.h index fdaa2ba..37aa636 100644 --- a/src/mpin_sdk.h +++ b/src/mpin_sdk.h @@ -127,6 +127,7 @@ public: INCORRECT_ACCESS_NUMBER, // Remote/local error - wrong access number (checksum failed or RPS returned 412) HTTP_SERVER_ERROR, // Remote error, that was not reduced to one of the above - the remote server returned internal server error status (5xx) HTTP_REQUEST_ERROR, // Remote error, that was not reduced to one of the above - invalid data sent to server, the remote server returned 4xx error status + BAD_USER_AGENT, // Remote error - user agent not supported }; Status(); @@ -282,6 +283,7 @@ private: static const int HTTP_BAD_REQUEST = 400; static const int HTTP_UNAUTHORIZED = 401; static const int HTTP_FORBIDDEN = 403; + static const int HTTP_NOT_ACCEPTABLE = 406; static const int HTTP_REQUEST_TIMEOUT = 408; static const int HTTP_GONE = 410; static const int HTTP_PRECONDITION_FAILED = 412;
