# HG changeset patch # User Sebastien Jodogne # Date 1592231283 -7200 # Node ID 3dda0d73193ca597cba362fa93420671348573af # Parent d6b7fb0f9652e3e0cd48ad0269b1140f98b39325 fix doxygen, more tolerant WebServiceParameters::SetUrl() diff -r d6b7fb0f9652 -r 3dda0d73193c OrthancFramework/Sources/WebServiceParameters.cpp --- a/OrthancFramework/Sources/WebServiceParameters.cpp Mon Jun 15 12:26:45 2020 +0200 +++ b/OrthancFramework/Sources/WebServiceParameters.cpp Mon Jun 15 16:28:03 2020 +0200 @@ -43,6 +43,7 @@ # include "SystemToolbox.h" #endif +#include #include namespace Orthanc @@ -89,10 +90,19 @@ void WebServiceParameters::SetUrl(const std::string& url) { - if (!Toolbox::StartsWith(url, "http://") && - !Toolbox::StartsWith(url, "https://")) + if (boost::find_first(url, "://")) { - throw OrthancException(ErrorCode_BadFileFormat, "Bad URL: " + url); + // Only allow the HTTP and HTTPS protocols + if (!Toolbox::StartsWith(url, "http://") && + !Toolbox::StartsWith(url, "https://")) + { + throw OrthancException(ErrorCode_BadFileFormat, "Bad URL: " + url); + } + } + + if (url.empty()) + { + throw OrthancException(ErrorCode_BadFileFormat, "Empty URL"); } // Add trailing slash if needed diff -r d6b7fb0f9652 -r 3dda0d73193c OrthancFramework/UnitTestsSources/RestApiTests.cpp --- a/OrthancFramework/UnitTestsSources/RestApiTests.cpp Mon Jun 15 12:26:45 2020 +0200 +++ b/OrthancFramework/UnitTestsSources/RestApiTests.cpp Mon Jun 15 16:28:03 2020 +0200 @@ -873,3 +873,19 @@ } } } + + +TEST(WebServiceParameters, Url) +{ + WebServiceParameters w; + + ASSERT_THROW(w.SetUrl("ssh://coucou"), OrthancException); + w.SetUrl("http://coucou"); + w.SetUrl("https://coucou"); + ASSERT_THROW(w.SetUrl("httpss://coucou"), OrthancException); + ASSERT_THROW(w.SetUrl(""), OrthancException); + + // New in Orthanc 1.7.2: Allow relative URLs (for DICOMweb in Stone) + w.SetUrl("coucou"); + w.SetUrl("/coucou"); +} diff -r d6b7fb0f9652 -r 3dda0d73193c OrthancServer/Resources/Orthanc.doxygen --- a/OrthancServer/Resources/Orthanc.doxygen Mon Jun 15 12:26:45 2020 +0200 +++ b/OrthancServer/Resources/Orthanc.doxygen Mon Jun 15 16:28:03 2020 +0200 @@ -51,7 +51,7 @@ # and the maximum width should not exceed 200 pixels. Doxygen will copy the logo # to the output directory. -PROJECT_LOGO = @CMAKE_SOURCE_DIR@/Resources/OrthancLogoDocumentation.png +PROJECT_LOGO = @CMAKE_SOURCE_DIR@/OrthancServer/Resources/OrthancLogoDocumentation.png # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is @@ -754,8 +754,8 @@ # spaces. # Note: If this tag is empty the current directory is searched. -INPUT = @CMAKE_SOURCE_DIR@/Core \ - @CMAKE_SOURCE_DIR@/OrthancServer +INPUT = @CMAKE_SOURCE_DIR@/OrthancFramework/Sources \ + @CMAKE_SOURCE_DIR@/OrthancServer/Sources # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff -r d6b7fb0f9652 -r 3dda0d73193c OrthancServer/Resources/OrthancPlugin.doxygen --- a/OrthancServer/Resources/OrthancPlugin.doxygen Mon Jun 15 12:26:45 2020 +0200 +++ b/OrthancServer/Resources/OrthancPlugin.doxygen Mon Jun 15 16:28:03 2020 +0200 @@ -51,7 +51,7 @@ # and the maximum width should not exceed 200 pixels. Doxygen will copy the logo # to the output directory. -PROJECT_LOGO = @CMAKE_SOURCE_DIR@/Resources/OrthancLogoDocumentation.png +PROJECT_LOGO = @CMAKE_SOURCE_DIR@/OrthancServer/Resources/OrthancLogoDocumentation.png # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is @@ -754,8 +754,8 @@ # spaces. # Note: If this tag is empty the current directory is searched. -INPUT = @CMAKE_SOURCE_DIR@/Plugins/Include/orthanc/OrthancCPlugin.h \ - @CMAKE_SOURCE_DIR@/Plugins/Include/orthanc/OrthancCDatabasePlugin.h +INPUT = @CMAKE_SOURCE_DIR@/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h \ + @CMAKE_SOURCE_DIR@/OrthancServer/Plugins/Include/orthanc/OrthancCDatabasePlugin.h # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses