changeset 4072:3dda0d73193c framework

fix doxygen, more tolerant WebServiceParameters::SetUrl()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 15 Jun 2020 16:28:03 +0200
parents d6b7fb0f9652
children 7116e34221fe
files OrthancFramework/Sources/WebServiceParameters.cpp OrthancFramework/UnitTestsSources/RestApiTests.cpp OrthancServer/Resources/Orthanc.doxygen OrthancServer/Resources/OrthancPlugin.doxygen
diffstat 4 files changed, 35 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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 <boost/algorithm/string/find.hpp>
 #include <cassert>
 
 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
--- 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");
+}
--- 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
--- 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