Commit e10b5488 authored by Paweł Wegner's avatar Paweł Wegner
Browse files

MegaNz: return 503 from file provider when not authorized just yet.

parent aa7a5561
...@@ -303,6 +303,9 @@ IHttpServer::IResponse::Pointer MegaNz::HttpServerCallback::receivedConnection( ...@@ -303,6 +303,9 @@ IHttpServer::IResponse::Pointer MegaNz::HttpServerCallback::receivedConnection(
if (!state || state != provider_->auth()->state()) if (!state || state != provider_->auth()->state())
return server.createResponse(IHttpRequest::Forbidden, {}, return server.createResponse(IHttpRequest::Forbidden, {},
"state parameter missing / invalid"); "state parameter missing / invalid");
if (!provider_->authorized_)
return server.createResponse(IHttpRequest::ServiceUnavailable, {},
"not authorized just yet");
const char* file = connection->getParameter("file"); const char* file = connection->getParameter("file");
std::unique_ptr<mega::MegaNode> node(provider_->mega()->getNodeByPath(file)); std::unique_ptr<mega::MegaNode> node(provider_->mega()->getNodeByPath(file));
if (!node) if (!node)
......
...@@ -43,6 +43,7 @@ class IHttpRequest { ...@@ -43,6 +43,7 @@ class IHttpRequest {
static constexpr int Forbidden = 403; static constexpr int Forbidden = 403;
static constexpr int NotFound = 404; static constexpr int NotFound = 404;
static constexpr int RangeInvalid = 416; static constexpr int RangeInvalid = 416;
static constexpr int ServiceUnavailable = 503;
static constexpr int Aborted = 600; static constexpr int Aborted = 600;
static constexpr int Unknown = 700; static constexpr int Unknown = 700;
static constexpr int Failure = 800; static constexpr int Failure = 800;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment