diff --git a/Code/Mantid/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp b/Code/Mantid/Framework/ScriptRepository/src/ScriptRepositoryImpl.cpp
index 7882622..08015e5 100644
a
|
b
|
namespace API |
787 | 787 | m_file->stream().seekg(0,std::ios::beg); |
788 | 788 | // set the size |
789 | 789 | req.setContentLength((int)sst.str().size()); |
790 | | |
791 | | std::ostream& ostr = session.sendRequest(req); |
| 790 | |
| 791 | std::ostream & ostr = session.sendRequest(req); |
792 | 792 | // send the request. |
793 | 793 | ostr << sst.str(); |
794 | 794 | |
… |
… |
namespace API |
1034 | 1034 | HTTPMessage::HTTP_1_0); |
1035 | 1035 | g_log.debug() << "Receive request to delete file " << file_path << " using " << url << std::endl; |
1036 | 1036 | |
| 1037 | // configure proxy |
| 1038 | std::string proxy_config; |
| 1039 | unsigned short proxy_port; |
| 1040 | if (getProxyConfig(proxy_config, proxy_port)) |
| 1041 | session.setProxy(proxy_config, proxy_port); |
| 1042 | // proxy end |
| 1043 | |
1037 | 1044 | |
1038 | 1045 | // fill up the form required from the server to delete one file, with the fields |
1039 | 1046 | // path, author, comment, email |
… |
… |
namespace API |
1045 | 1052 | |
1046 | 1053 | // send the request to the server |
1047 | 1054 | form.prepareSubmit(req); |
| 1055 | |
1048 | 1056 | std::ostream& ostr = session.sendRequest(req); |
1049 | 1057 | form.write(ostr); |
1050 | | |
| 1058 | |
1051 | 1059 | // get the answer from the server |
1052 | 1060 | HTTPResponse response; |
1053 | 1061 | std::istream & rs = session.receiveResponse(response); |
… |
… |
bool ScriptRepositoryImpl::getProxyConfig(std::string& proxy_server, unsigned sh |
1782 | 1790 | PROXYSERVER = proxy_option; |
1783 | 1791 | PROXYPORT = 8080; |
1784 | 1792 | } |
1785 | | g_log.notice() << "ScriptRepository proxy found. Host: " << PROXYSERVER << " Port: " << PROXYPORT << std::endl; |
| 1793 | |
| 1794 | try{ |
| 1795 | // test if the proxy is valid for the remote conection |
| 1796 | Poco::URI uri(remote_url); |
| 1797 | Poco::Net::HTTPClientSession session(uri.getHost(),uri.getPort()); |
| 1798 | session.setProxy(PROXYSERVER, PROXYPORT); |
| 1799 | Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, "/", |
| 1800 | Poco::Net::HTTPMessage::HTTP_1_1); |
| 1801 | session.sendRequest(request); |
| 1802 | Poco::Net::HTTPResponse response; |
| 1803 | std::istream & rs = session.receiveResponse(response); |
| 1804 | Poco::NullOutputStream null; |
| 1805 | Poco::StreamCopier::copyStream(rs,null); |
| 1806 | g_log.notice() << "ScriptRepository proxy found. Host: " << PROXYSERVER << " Port: " << PROXYPORT << std::endl; |
| 1807 | }catch (Poco::Net::HostNotFoundException & ex){ |
| 1808 | g_log.information() << "ScriptRepository found that for this connection proxy can not be used. \n" |
| 1809 | << ex.displayText() << std::endl; |
| 1810 | PROXYSERVER = ""; |
| 1811 | PROXYPORT = 0; |
| 1812 | } |
| 1813 | |
1786 | 1814 | } |
| 1815 | |
1787 | 1816 | #endif |
1788 | 1817 | } |
1789 | 1818 | firstTime = false; |