package com.commafeed.backend;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.params.CookiePolicy;
import org.apache.http.client.params.HttpClientParams;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParams;
import org.apache.http.util.EntityUtils;

public class HttpGetter {

	public String get(String url) throws Exception {
		return new String(getBinary(url), "UTF-8");
	}

	public byte[] getBinary(String url) throws Exception {
		byte[] content = null;

		HttpClient httpclient = new DefaultHttpClient();
		HttpParams params = httpclient.getParams();
		HttpClientParams.setCookiePolicy(params, CookiePolicy.IGNORE_COOKIES);
		HttpProtocolParams.setContentCharset(params, "UTF-8");
		HttpConnectionParams.setConnectionTimeout(params, 5000);
		HttpConnectionParams.setSoTimeout(params, 5000);

		try {
			HttpGet httpget = new HttpGet(url);
			HttpResponse response = httpclient.execute(httpget);
			HttpEntity entity = response.getEntity();
			if (entity != null) {
				content = EntityUtils.toByteArray(entity);
			}
		} finally {
			httpclient.getConnectionManager().shutdown();
		}
		return content;
	}
}

@@ -1154,24 +1154,121 @@
 pGet(url);%0D%0A
+%09%09%09httpget.addHeader(%22Pragma%22, %22No-cache%22);%0D%0A%09%09%09httpget.addHeader(%22Cache-Control%22, %22no-cache%22);%0D%0A
 %09%09%09HttpRespo

disable http cache