Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
4071:d6b7fb0f9652 | 4072:3dda0d73193c |
---|---|
41 | 41 |
42 #if ORTHANC_SANDBOXED == 0 | 42 #if ORTHANC_SANDBOXED == 0 |
43 # include "SystemToolbox.h" | 43 # include "SystemToolbox.h" |
44 #endif | 44 #endif |
45 | 45 |
46 #include <boost/algorithm/string/find.hpp> | |
46 #include <cassert> | 47 #include <cassert> |
47 | 48 |
48 namespace Orthanc | 49 namespace Orthanc |
49 { | 50 { |
50 static const char* KEY_CERTIFICATE_FILE = "CertificateFile"; | 51 static const char* KEY_CERTIFICATE_FILE = "CertificateFile"; |
87 } | 88 } |
88 | 89 |
89 | 90 |
90 void WebServiceParameters::SetUrl(const std::string& url) | 91 void WebServiceParameters::SetUrl(const std::string& url) |
91 { | 92 { |
92 if (!Toolbox::StartsWith(url, "http://") && | 93 if (boost::find_first(url, "://")) |
93 !Toolbox::StartsWith(url, "https://")) | 94 { |
94 { | 95 // Only allow the HTTP and HTTPS protocols |
95 throw OrthancException(ErrorCode_BadFileFormat, "Bad URL: " + url); | 96 if (!Toolbox::StartsWith(url, "http://") && |
97 !Toolbox::StartsWith(url, "https://")) | |
98 { | |
99 throw OrthancException(ErrorCode_BadFileFormat, "Bad URL: " + url); | |
100 } | |
101 } | |
102 | |
103 if (url.empty()) | |
104 { | |
105 throw OrthancException(ErrorCode_BadFileFormat, "Empty URL"); | |
96 } | 106 } |
97 | 107 |
98 // Add trailing slash if needed | 108 // Add trailing slash if needed |
99 if (url[url.size() - 1] == '/') | 109 if (url[url.size() - 1] == '/') |
100 { | 110 { |