Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from mantidproject/feature/10371_osx_proxy_issue
Feature/10371 osx proxy issue
- Loading branch information
Showing
10 changed files
with
2,418 additions
and
1,584 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#ifndef MANTID_KERNEL_PROXYINFO_H_ | ||
#define MANTID_KERNEL_PROXYINFO_H_ | ||
|
||
#include "MantidKernel/System.h" | ||
#include <string> | ||
|
||
namespace Mantid | ||
{ | ||
namespace Kernel | ||
{ | ||
|
||
/** ProxyInfo : Container for carrying around 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 ProxyInfo | ||
{ | ||
private: | ||
std::string m_host; | ||
int m_port; | ||
bool m_isHttpProxy; | ||
bool m_isEmptyProxy; | ||
|
||
public: | ||
virtual ~ProxyInfo(); | ||
ProxyInfo(); | ||
ProxyInfo(const ProxyInfo& other); | ||
ProxyInfo& operator=(const ProxyInfo& other); | ||
ProxyInfo(const std::string& host, const int port, const bool isHttpProxy); | ||
std::string host() const; | ||
int port() const; | ||
bool isHttpProxy() const; | ||
bool emptyProxy() const; | ||
|
||
}; | ||
|
||
} // namespace Kernel | ||
} // namespace Mantid | ||
|
||
#endif /* MANTID_KERNEL_PROXYINFO_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,40 @@ | ||
#include "MantidKernel/NetworkProxy.h" | ||
#include <Poco/URI.h> | ||
|
||
namespace Mantid | ||
{ | ||
namespace Kernel | ||
{ | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Constructor | ||
*/ | ||
NetworkProxy::NetworkProxy() : | ||
m_logger("network_proxy_logger_generic") | ||
{ | ||
} | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Destructor | ||
*/ | ||
NetworkProxy::~NetworkProxy() | ||
{ | ||
} | ||
|
||
ProxyInfo NetworkProxy::getHttpProxy(const std::string&) | ||
{ | ||
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*/); | ||
} | ||
return proxyInfo; | ||
} | ||
|
||
} // namespace Kernel | ||
} // namespace Mantid |
Oops, something went wrong.