mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-07 22:02:12 +08:00
namedirectory: consider error 400 as invalid
GitLab: #1100 Change-Id: I22255a2b34e5c33d1db4c1a02747874512372d5b
This commit is contained in:
@ -191,7 +191,9 @@ NameDirectory::lookupAddress(const std::string& addr, LookupCallback cb)
|
|||||||
cb(cacheResult.first, cacheResult.second, Response::found);
|
cb(cacheResult.first, cacheResult.second, Response::found);
|
||||||
else
|
else
|
||||||
cb("", "", Response::notFound);
|
cb("", "", Response::notFound);
|
||||||
} else if (response.status_code != 200) {
|
} else if (response.status_code == 400)
|
||||||
|
cb("", "", Response::invalidResponse);
|
||||||
|
else if (response.status_code != 200) {
|
||||||
JAMI_ERROR("Address lookup for {} on {} failed with code={}",
|
JAMI_ERROR("Address lookup for {} on {} failed with code={}",
|
||||||
addr, serverUrl_, response.status_code);
|
addr, serverUrl_, response.status_code);
|
||||||
cb("", "", Response::error);
|
cb("", "", Response::error);
|
||||||
@ -274,6 +276,8 @@ NameDirectory::lookupName(const std::string& name, LookupCallback cb)
|
|||||||
const dht::http::Response& response) {
|
const dht::http::Response& response) {
|
||||||
if (response.status_code > 400 && response.status_code < 500)
|
if (response.status_code > 400 && response.status_code < 500)
|
||||||
cb("", "", Response::notFound);
|
cb("", "", Response::notFound);
|
||||||
|
else if (response.status_code == 400)
|
||||||
|
cb("", "", Response::invalidResponse);
|
||||||
else if (response.status_code < 200 || response.status_code > 299) {
|
else if (response.status_code < 200 || response.status_code > 299) {
|
||||||
JAMI_ERROR("Name lookup for {} on {} failed with code={}",
|
JAMI_ERROR("Name lookup for {} on {} failed with code={}",
|
||||||
name, serverUrl_, response.status_code);
|
name, serverUrl_, response.status_code);
|
||||||
|
Reference in New Issue
Block a user