Hey folks, originating from this thread: http://www.nabble.com/Request-for-patch%3A-http-proxy--%3E-setting-user---password-not-possible-td16823746s2354.html
i wrote a patch for the current stable AMQ sourcecode.(-> http://www.nabble.com/file/p17080298/amq-proxy-cred.patch amq-proxy-cred.patch ) The patch itself is quite simple (thank god you already used apache http-client): Patched files: We have to patch the following files * HttpClientTransport.java * HttpTransportSupport.java in the directory apache-activemq-5.0.0/src/activemq-optional/src/main/java/org/apache/activemq/transport/http and the file * pom.xml in the directory apache-activemq-5.0.0/src/ Modifications: * HttpClientTransport a) Add import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.auth.AuthScope; to the import-statements. b) Change protected HttpClient createHttpClient() { HttpClient client = new HttpClient(); if (getProxyHost() != null) { client.getHostConfiguration().setProxy(getProxyHost(), getProxyPort()); } return client; } to protected HttpClient createHttpClient() { HttpClient client = new HttpClient(); if (getProxyHost() != null) { client.getHostConfiguration().setProxy(getProxyHost(), getProxyPort()); } if(getProxyUser() != null && getProxyPassword() != null) { client.getState().setProxyCredentials( new AuthScope(getProxyHost(), getProxyPort()), new UsernamePasswordCredentials(getProxyUser(), getProxyPassword())); } return client; } c) Change the run() method, find the last catch-block } catch (IOException e) { onException(IOExceptionSupport.create("Failed to perform GET on: " + remoteUrl + " Reason: " + e.getMessage(), e)); break; } finally { httpMethod.getResponseBody(); httpMethod.releaseConnection(); } and change it to finally { try { httpMethod.getResponseBody(); } catch (IOException e) { e.printStackTrace(); } httpMethod.releaseConnection(); } * HttpTransportSupport Add this to the source-code: private String proxyUser; private String proxyPassword; and the corresponding getter and setter-methods. *pom.xml Change line 46 from <commons-httpclient-version>2.0.1</commons-httpclient-version> to <commons-httpclient-version>3.1</commons-httpclient-version> Apply the patch: cd $unpacked_amq_source patch -p1 <amq-proxy-cred.patch I tested the patch using: * 2 SLES 9 hosts running two patched brokers * squid-proxy (2.6.14) running on Ubuntu 7.10 with mandatory authentication Works like a charm! Last problem: I have not been able to figure out how to pass the proxy-parameters to the http-transport connector. Something like: <networkConnector name="outbound_http" uri="static://(http://esf-proto-2:61617)?trace=true&proxyHost=sdoesmon&proxyPort=3128" networkTTL="5"/> doesn't cause any errors on start-up but seems to be simply ignored (For the tests - in lack of better knowlegde - i had compiled those configuration values into the source-code). Is this patch helpfull for you? I believe i am not the only one in need of support for http-proxy-support with AMQ using credentials.... Any advice on the above mentioned configuration issue? -- View this message in context: http://www.nabble.com/Patch-for-authenticating-http-proxies-finished.-Interested--tp17080298s2354p17080298.html Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
