Mercurial > hg > orthanc-stone
diff OrthancStone/Sources/Loaders/DicomSource.cpp @ 2161:e65fe2e50fde dicom-sr tip
integration mainline->dicom-sr
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 27 Sep 2024 22:34:17 +0200 |
parents | 32bfccdc030f |
children |
line wrap: on
line diff
--- a/OrthancStone/Sources/Loaders/DicomSource.cpp Sat Aug 31 08:40:01 2024 +0200 +++ b/OrthancStone/Sources/Loaders/DicomSource.cpp Fri Sep 27 22:34:17 2024 +0200 @@ -25,6 +25,7 @@ #include "../Oracle/HttpCommand.h" #include "../Oracle/OrthancRestApiCommand.h" +#include "../Toolbox/StoneToolbox.h" #include <OrthancException.h> #include <Toolbox.h> @@ -60,39 +61,6 @@ } - static std::string AddUriSuffix(const std::string& base, - const std::string& suffix) - { - if (base.empty()) - { - return suffix; - } - else if (suffix.empty()) - { - return base; - } - else - { - char lastBase = base[base.size() - 1]; - - if (lastBase == '/' && - suffix[0] == '/') - { - return base + suffix.substr(1); - } - else if (lastBase == '/' || - suffix[0] == '/') - { - return base + suffix; - } - else - { - return base + "/" + suffix; - } - } - } - - void DicomSource::SetOrthancSource(const Orthanc::WebServiceParameters& parameters) { type_ = DicomSourceType_Orthanc; @@ -229,7 +197,7 @@ std::unique_ptr<HttpCommand> command(new HttpCommand); command->SetMethod(Orthanc::HttpMethod_Get); - command->SetUrl(AddUriSuffix(webService_.GetUrl(), uri + EncodeGetArguments(arguments))); + command->SetUrl(StoneToolbox::JoinUrl(webService_.GetUrl(), uri + EncodeGetArguments(arguments))); command->SetHttpHeaders(webService_.GetHttpHeaders()); for (std::map<std::string, std::string>::const_iterator @@ -274,7 +242,7 @@ std::unique_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); command->SetMethod(Orthanc::HttpMethod_Post); - command->SetUri(AddUriSuffix(orthancDicomWebRoot_, "/servers/" + serverName_ + "/get")); + command->SetUri(StoneToolbox::JoinUrl(orthancDicomWebRoot_, "/servers/" + serverName_ + "/get")); command->SetBody(body); if (protection.get())