Mercurial > hg > orthanc
comparison OrthancServer/OrthancInitialization.cpp @ 1533:0011cc99443c
improving HTTPS support
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 12 Aug 2015 17:52:10 +0200 |
parents | 096a8af528c9 |
children | 95b3b0260240 |
comparison
equal
deleted
inserted
replaced
1532:b5eb5210af91 | 1533:0011cc99443c |
---|---|
75 static Json::Value configuration_; | 75 static Json::Value configuration_; |
76 static boost::filesystem::path defaultDirectory_; | 76 static boost::filesystem::path defaultDirectory_; |
77 static std::string configurationAbsolutePath_; | 77 static std::string configurationAbsolutePath_; |
78 | 78 |
79 | 79 |
80 static std::string GetGlobalStringParameterInternal(const std::string& parameter, | |
81 const std::string& defaultValue) | |
82 { | |
83 if (configuration_.isMember(parameter)) | |
84 { | |
85 return configuration_[parameter].asString(); | |
86 } | |
87 else | |
88 { | |
89 return defaultValue; | |
90 } | |
91 } | |
92 | |
93 | |
94 static bool GetGlobalBoolParameterInternal(const std::string& parameter, | |
95 bool defaultValue) | |
96 { | |
97 if (configuration_.isMember(parameter)) | |
98 { | |
99 return configuration_[parameter].asBool(); | |
100 } | |
101 else | |
102 { | |
103 return defaultValue; | |
104 } | |
105 } | |
106 | |
107 | |
108 | |
80 static void AddFileToConfiguration(const boost::filesystem::path& path) | 109 static void AddFileToConfiguration(const boost::filesystem::path& path) |
81 { | 110 { |
82 LOG(WARNING) << "Reading the configuration from: " << path; | 111 LOG(WARNING) << "Reading the configuration from: " << path; |
83 | 112 |
84 Json::Value config; | 113 Json::Value config; |
284 InitializeServerEnumerations(); | 313 InitializeServerEnumerations(); |
285 | 314 |
286 // Read the user-provided configuration | 315 // Read the user-provided configuration |
287 ReadGlobalConfiguration(configurationFile); | 316 ReadGlobalConfiguration(configurationFile); |
288 | 317 |
289 HttpClient::GlobalInitialize(); | 318 HttpClient::GlobalInitialize(GetGlobalBoolParameterInternal("HttpsVerifyPeers", true), |
319 GetGlobalStringParameterInternal("HttpsVerifyCertificates", "")); | |
290 | 320 |
291 RegisterUserMetadata(); | 321 RegisterUserMetadata(); |
292 RegisterUserContentType(); | 322 RegisterUserContentType(); |
293 | 323 |
294 DicomServer::InitializeDictionary(); | 324 DicomServer::InitializeDictionary(); |
335 ERR_free_strings(); | 365 ERR_free_strings(); |
336 #endif | 366 #endif |
337 } | 367 } |
338 | 368 |
339 | 369 |
340 | |
341 std::string Configuration::GetGlobalStringParameter(const std::string& parameter, | 370 std::string Configuration::GetGlobalStringParameter(const std::string& parameter, |
342 const std::string& defaultValue) | 371 const std::string& defaultValue) |
343 { | 372 { |
344 boost::mutex::scoped_lock lock(globalMutex_); | 373 boost::mutex::scoped_lock lock(globalMutex_); |
345 | 374 return GetGlobalStringParameterInternal(parameter, defaultValue); |
346 if (configuration_.isMember(parameter)) | |
347 { | |
348 return configuration_[parameter].asString(); | |
349 } | |
350 else | |
351 { | |
352 return defaultValue; | |
353 } | |
354 } | 375 } |
355 | 376 |
356 | 377 |
357 int Configuration::GetGlobalIntegerParameter(const std::string& parameter, | 378 int Configuration::GetGlobalIntegerParameter(const std::string& parameter, |
358 int defaultValue) | 379 int defaultValue) |
372 | 393 |
373 bool Configuration::GetGlobalBoolParameter(const std::string& parameter, | 394 bool Configuration::GetGlobalBoolParameter(const std::string& parameter, |
374 bool defaultValue) | 395 bool defaultValue) |
375 { | 396 { |
376 boost::mutex::scoped_lock lock(globalMutex_); | 397 boost::mutex::scoped_lock lock(globalMutex_); |
377 | 398 return GetGlobalBoolParameterInternal(parameter, defaultValue); |
378 if (configuration_.isMember(parameter)) | |
379 { | |
380 return configuration_[parameter].asBool(); | |
381 } | |
382 else | |
383 { | |
384 return defaultValue; | |
385 } | |
386 } | 399 } |
387 | 400 |
388 | 401 |
389 void Configuration::GetDicomModalityUsingSymbolicName(RemoteModalityParameters& modality, | 402 void Configuration::GetDicomModalityUsingSymbolicName(RemoteModalityParameters& modality, |
390 const std::string& name) | 403 const std::string& name) |