HttpClient(DownloadSettings settings) {
this.settings = settings;
httpClient = new DefaultHttpClient();
interceptor = new DownloaderInterceptor();
httpClient.addRequestInterceptor(interceptor);
HttpParams params = httpClient.getParams();
params.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, false);
//params.setParameter(CoreProtocolPNames.USER_AGENT, settings.getHttpUserAgent());
String proxys = settings.getHttpProxyServer();
int port = settings.getHttpProxyPort();
if (proxys != null && !proxys.equals("")) {
HttpHost proxy;
if (port > 0) {
proxy = new HttpHost(settings.getHttpProxyServer(), settings.getHttpProxyPort());
} else {
proxy = new HttpHost(settings.getHttpProxyServer());
}
params.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
}
//TODO add support for SOCKS
}