Mercurial > hg > orthanc
diff OrthancServer/OrthancInitialization.cpp @ 485:bdbde1fbfab3
send resources through HTTP
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 16 Jul 2013 13:48:33 +0200 |
parents | b8ace6fc1d1f |
children | 1b2cdc855bd3 |
line wrap: on
line diff
--- a/OrthancServer/OrthancInitialization.cpp Tue Jul 16 12:51:27 2013 +0200 +++ b/OrthancServer/OrthancInitialization.cpp Tue Jul 16 13:48:33 2013 +0200 @@ -282,12 +282,30 @@ try { url = modalities[name].get(0u, "").asString(); - username = modalities[name].get(1u, "").asString(); - password = modalities[name].get(2u, "").asString(); + + if (modalities[name].size() == 1) + { + username = ""; + password = ""; + } + else if (modalities[name].size() == 3) + { + username = modalities[name].get(1u, "").asString(); + password = modalities[name].get(2u, "").asString(); + } + else + { + throw OrthancException(ErrorCode_BadFileFormat); + } } catch (...) { - throw OrthancException("Badly formatted Orthanc peer"); + throw OrthancException(ErrorCode_BadFileFormat); + } + + if (url.size() != 0 && url[url.size() - 1] != '/') + { + url += '/'; } }