comparison OrthancStone/Sources/Platforms/WebAssembly/WebAssemblyOracle.cpp @ 2153:32bfccdc030f

consistency in the way URLs are concatenated
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 25 Sep 2024 18:09:24 +0200
parents 16c01cc201e7
children
comparison
equal deleted inserted replaced
2151:02a06434833c 2153:32bfccdc030f
27 // This is the case when using the WebAssembly side module, and this 27 // This is the case when using the WebAssembly side module, and this
28 // source file must be compiled within the WebAssembly main module 28 // source file must be compiled within the WebAssembly main module
29 # include <Oracle/WebAssemblyOracle_Includes.h> 29 # include <Oracle/WebAssemblyOracle_Includes.h>
30 #endif 30 #endif
31 31
32 #include "../../Toolbox/StoneToolbox.h"
33
32 #include <OrthancException.h> 34 #include <OrthancException.h>
33 #include <Toolbox.h> 35 #include <Toolbox.h>
34 36
35 #include <emscripten.h> 37 #include <emscripten.h>
36 #include <emscripten/html5.h> 38 #include <emscripten/html5.h>
540 void WebAssemblyOracle::SetOrthancUrl(FetchCommand& command, 542 void WebAssemblyOracle::SetOrthancUrl(FetchCommand& command,
541 const std::string& uri) const 543 const std::string& uri) const
542 { 544 {
543 if (isLocalOrthanc_) 545 if (isLocalOrthanc_)
544 { 546 {
545 command.SetUrl(localOrthancRoot_ + uri); 547 command.SetUrl(StoneToolbox::JoinUrl(localOrthancRoot_, uri));
546 } 548 }
547 else 549 else
548 { 550 {
549 command.SetUrl(remoteOrthanc_.GetUrl() + uri); 551 command.SetUrl(StoneToolbox::JoinUrl(remoteOrthanc_.GetUrl(), uri));
550 command.AddHttpHeaders(remoteOrthanc_.GetHttpHeaders()); 552 command.AddHttpHeaders(remoteOrthanc_.GetHttpHeaders());
551 553
552 if (!remoteOrthanc_.GetUsername().empty()) 554 if (!remoteOrthanc_.GetUsername().empty())
553 { 555 {
554 command.SetCredentials(remoteOrthanc_.GetUsername(), remoteOrthanc_.GetPassword()); 556 command.SetCredentials(remoteOrthanc_.GetUsername(), remoteOrthanc_.GetPassword());