diff OrthancFramework/Sources/WebServiceParameters.cpp @ 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 d25f4c0fa160
children dcf4d83374a6
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