Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #10371. Move services to kernel.
This needs to be checked on all other OS. I doubt this works yet on windows or linux properly.
- Loading branch information
1 parent
b4f4a1a
commit a00b146
Showing
10 changed files
with
2,151 additions
and
1,609 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
Code/Mantid/Framework/Kernel/inc/MantidKernel/NetworkProxy.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#ifndef MANTID_KERNEL_NETWORKPROXY_H_ | ||
#define MANTID_KERNEL_NETWORKPROXY_H_ | ||
|
||
#include "MantidKernel/System.h" | ||
#include "MantidKernel/ProxyInfo.h" | ||
#include "MantidKernel/Logger.h" | ||
|
||
|
||
namespace Mantid | ||
{ | ||
namespace Kernel | ||
{ | ||
|
||
/** NetworkProxy : Network proxy utility for getting network proxy information. | ||
Copyright © 2014 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory | ||
This file is part of Mantid. | ||
Mantid is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
Mantid is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
File change history is stored at: <https://github.com/mantidproject/mantid> | ||
Code Documentation is available at: <http://doxygen.mantidproject.org> | ||
*/ | ||
class DLLExport NetworkProxy | ||
{ | ||
public: | ||
/// Constructor | ||
NetworkProxy(); | ||
|
||
/// Get http proxy information. | ||
ProxyInfo getHttpProxy(const std::string& targetURLString); | ||
|
||
/// Destructor | ||
virtual ~NetworkProxy(); | ||
|
||
private: | ||
|
||
/// Logger object | ||
Mantid::Kernel::Logger m_logger; | ||
|
||
}; | ||
|
||
|
||
} // namespace Kernel | ||
} // namespace Mantid | ||
|
||
#endif /* MANTID_KERNEL_NETWORKPROXY_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include "MantidKernel/NetworkProxy.h" | ||
|
||
namespace Mantid | ||
{ | ||
namespace Kernel | ||
{ | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Constructor | ||
*/ | ||
NetworkProxy::NetworkProxy() : | ||
m_logger("network_proxy_logger_generic") | ||
{ | ||
} | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Destructor | ||
*/ | ||
NetworkProxy::~NetworkProxy() | ||
{ | ||
} | ||
|
||
ProxyInfo NetworkProxy::getHttpProxy(const std::string& targetURLString) | ||
{ | ||
ProxyInfo proxyInfo; // NoProxy. | ||
char * proxy_var = getenv("http_proxy"); | ||
if (proxy_var == 0) | ||
proxy_var = getenv("HTTP_PROXY"); | ||
|
||
if (proxy_var != 0) | ||
{ | ||
Poco::URI uri_p(proxy_var); | ||
proxyInfo = ProxyInfo(uri_p.getHost(), uri_p.getPort(), true /*http proxy*/); | ||
} | ||
} | ||
|
||
} // namespace Kernel | ||
} // namespace Mantid |
Oops, something went wrong.