mod_http_upload: Fix HTTP response matching

Fix the case where a service_url is specified and the service returns a
non-2xx status code.
This commit is contained in:
Holger Weiss 2015-08-30 00:12:53 +02:00
parent 19044ccb85
commit 12274a2adc
1 changed files with 4 additions and 4 deletions

View File

@ -519,16 +519,16 @@ create_slot(#state{service_url = ServiceURL}, User, File, Size, ContentType,
[User, ServiceURL, Lines]), [User, ServiceURL, Lines]),
{error, ?ERR_SERVICE_UNAVAILABLE} {error, ?ERR_SERVICE_UNAVAILABLE}
end; end;
{error, {402, _Body}} -> {ok, {402, _Body}} ->
?INFO_MSG("Got status code 402 for ~s from <~s>", [User, ServiceURL]), ?INFO_MSG("Got status code 402 for ~s from <~s>", [User, ServiceURL]),
{error, ?ERR_RESOURCE_CONSTRAINT}; {error, ?ERR_RESOURCE_CONSTRAINT};
{error, {403, _Body}} -> {ok, {403, _Body}} ->
?INFO_MSG("Got status code 403 for ~s from <~s>", [User, ServiceURL]), ?INFO_MSG("Got status code 403 for ~s from <~s>", [User, ServiceURL]),
{error, ?ERR_NOT_ALLOWED}; {error, ?ERR_NOT_ALLOWED};
{error, {413, _Body}} -> {ok, {413, _Body}} ->
?INFO_MSG("Got status code 413 for ~s from <~s>", [User, ServiceURL]), ?INFO_MSG("Got status code 413 for ~s from <~s>", [User, ServiceURL]),
{error, ?ERR_NOT_ACCEPTABLE}; {error, ?ERR_NOT_ACCEPTABLE};
{error, {Code, _Body}} -> {ok, {Code, _Body}} ->
?ERROR_MSG("Got unexpected status code ~s from <~s>: ~B", ?ERROR_MSG("Got unexpected status code ~s from <~s>: ~B",
[User, ServiceURL, Code]), [User, ServiceURL, Code]),
{error, ?ERR_SERVICE_UNAVAILABLE}; {error, ?ERR_SERVICE_UNAVAILABLE};