Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fetcher] proxy support #330

Closed
maxfieb opened this issue Mar 20, 2017 · 2 comments
Closed

[fetcher] proxy support #330

maxfieb opened this issue Mar 20, 2017 · 2 comments

Comments

@maxfieb
Copy link

maxfieb commented Mar 20, 2017

rome-fetcher does not pass through any proxy parameters to httpcommons library

a commons http proxy example is at :

https://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientExecuteProxy.java

there are many cases where setting the proxy jvm-wide is not an option, and when you deploy a production service, you have a particular proxy for a particular purpose. also setting the proxy jvm wide allows any code in that vm to get out to anywhere, and that is not always ideal, security-wise.

(setting http.proxyHost and http.proxyPort JVM-wide didn't seem to work for me, either)

@maxfieb
Copy link
Author

maxfieb commented Mar 20, 2017

Seems like even without direct access (requiring a proxy) the usage still fires a feed updated event, the event fires with Message message but with a null value. none of the ERROR / WARN returned by httpclient are logged, which is a bit misleading / confusing.

The only debug message (same message success or fail) is :

DEBUG o.s.i.f.i.FeedEntryMessageSource - EVENT: Feed Polled. URL = http://www.dailytelegraph.com.au/news/national/rss

Which does not indicate success or failure. Maybe that's by design though, dunno.

This fails the same if system wide http.proxyHost / http.proxyPort are set, but various places on the interwebs seem to imply that apache commons does not use these proxy variables by default. The test case for this in the rome-fetcher example FeedReader.java is a no-op in this case, it always returns success.

Looking furthur, there is this : http://stackoverflow.com/questions/5165126/without-changing-code-how-to-force-httpclient-to-use-proxy-by-environment-varia

So httpclient can use system properties by default, but doesn't unless you can construct the httpClient object yourself, it did not seem to be the default behaviour, you have to configure (the deprecated) SystemDefaultHttpClient or the HttpClientBuilder.html#useSystemProperties() explicitly.

But in any case, i think i'd prefer an explicit proxy setting AND a configurable, but default way of using system properties, as it depends very greatly if you are doing dev or test cases, or doing a production build where you are limiting outbound connections to those that are known.

You could pass in proxy url to rome-fetcher configured it as in the provided example, but also have a boolean configurable that causes the default use of system properties when constructing the httpClient object, that might be useful for dev and test cases. I think having no proxy by default is probably a good one, and then setting either the proxy URL(scheme/host/port) explicitly or the boolean to use the system proxy properties.

@maxfieb maxfieb changed the title rome-fetcher proxy support [fetcher] proxy support Mar 20, 2017
@PatrickGotthard
Copy link
Member

Hi @maxfieb,

rome-fetcher is deprecated and will be removed in a future version. Have a look at #276

Regards,
Patrick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants