Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
just cosmetics - keeping my baby clean :-)
sixcooler8d63f3b70fd8
diff --git a/source/net/yacy/cora/protocol/http/HTTPClient.java b/source/net/yacy/cora/protocol/http/HTTPClient.javaindex 0e0022fa2..95dec02fc 100644--- a/source/net/yacy/cora/protocol/http/HTTPClient.java+++ b/source/net/yacy/cora/protocol/http/HTTPClient.java@@ -150,17 +150,17 @@ public class HTTPClient {* HTTP connection settings*/// timeout in milliseconds until a connection is established in milliseconds- HttpConnectionParams.setConnectionTimeout(httpParams, 9500);+ HttpConnectionParams.setConnectionTimeout(httpParams, 6000);// SO_LINGER affects the socket close operation in seconds// HttpConnectionParams.setLinger(httpParams, 6);// HttpConnectionParams.setSocketBufferSize(httpParams, 8192);// SO_TIMEOUT: maximum period inactivity between two consecutive data packets in milliseconds- HttpConnectionParams.setSoTimeout(httpParams, 9900);+ HttpConnectionParams.setSoTimeout(httpParams, 1000);// getting an I/O error when executing a request over a connection that has been closed at the server sideHttpConnectionParams.setStaleCheckingEnabled(httpParams, true);// conserve bandwidth by minimizing the number of segments that are sentHttpConnectionParams.setTcpNoDelay(httpParams, false);- // TODO: testing reuse of socket - there will be HttpConnectionParams.setSoReuseaddr(HttpParams params, boolean reuseaddr) in core-4.1+ // Defines whether the socket can be bound even though a previous connection is still in a timeout state.HttpConnectionParams.setSoReuseaddr(httpParams, true);httpClient = new DefaultHttpClient(clientConnectionManager, httpParams);@@ -195,6 +195,16 @@ public class HTTPClient {}+ /**+ * this method sets a host on which more than the default of 2 router per host are allowed+ *+ * @param the host to be raised in 'route per host'+ */+ public static void setMaxRouteHost(final String host) {+ HttpHost mHost = new HttpHost(host);+ ((ThreadSafeClientConnManager) httpClient.getConnectionManager()).setMaxForRoute(new HttpRoute(mHost), 50);+ }+/*** This method sets the Header used for the request*@@ -337,7 +347,7 @@ public class HTTPClient {}/**- * This method POSTs a page from the server.+ * send data to the server named by uri** @param uri the url to post* @param parts to post@@ -346,13 +356,27 @@ public class HTTPClient {*/public byte[] POSTbytes(final String uri, final Map<String, ContentBody> parts, final boolean usegzip) throws IOException {final MultiProtocolURI url = new MultiProtocolURI(uri);- final HttpPost httpPost = new HttpPost(url.toNormalform(true, false, true, false));- String host = url.getHost();- if (host == null) host = "127.0.0.1";- setHost(host); // overwrite resolved IP, needed for shared web hosting DO NOT REMOVE, see http://en.wikipedia.org/wiki/Shared_web_hosting_service+ return POSTbytes(url, url.getHost(), parts, usegzip);+ }++ /**+ * send data to the server named by vhost+ *+ * @param url address of the server+ * @param vhost name of the server at address which should respond+ * @param post data to send (name-value-pairs)+ * @param usegzip if the body should be gzipped+ * @return response body+ * @throws IOException+ */+ public byte[] POSTbytes(final MultiProtocolURI url, final String vhost, final Map<String, ContentBody> post, final boolean usegzip) throws IOException {+ final HttpPost httpPost = new HttpPost(url.toNormalform(true, false, true, false));++ setHost(vhost); // overwrite resolved IP, needed for shared web hosting DO NOT REMOVE, see http://en.wikipedia.org/wiki/Shared_web_hosting_service+ if (vhost == null) setHost("127.0.0.1");final MultipartEntity multipartEntity = new MultipartEntity();- for (final Entry<String,ContentBody> part : parts.entrySet())+ for (final Entry<String,ContentBody> part : post.entrySet())multipartEntity.addPart(part.getKey(), part.getValue());// statisticsupbytes = multipartEntity.getContentLength();@@ -366,6 +390,15 @@ public class HTTPClient {return getContentBytes(httpPost, Long.MAX_VALUE);}+ /**+ * send stream-data to the server named by uri+ *+ * @param uri the url to post+ * @param instream the stream to send+ * @param length the length of the stream+ * @return content bytes+ * @throws IOException+ */public byte[] POSTbytes(final String uri, final InputStream instream, long length) throws IOException {final MultiProtocolURI url = new MultiProtocolURI(uri);final HttpPost httpPost = new HttpPost(url.toNormalform(true, false, true, false));@@ -380,27 +413,6 @@ public class HTTPClient {currentRequest = httpPost;return getContentBytes(httpPost, Long.MAX_VALUE);}-- /**- * send data to the server named by vhost- *- * @param url address of the server- * @param vhost name of the server at address which should respond- * @param post data to send (name-value-pairs)- * @param usegzip if the body should be gzipped- * @return response body- * @throws IOException- */- public byte[] POSTbytes(final MultiProtocolURI url, final String vhost, final Map<String, ContentBody> post, final boolean usegzip) throws IOException {- this.setHost(vhost);- byte[] b;- try {- b = this.POSTbytes(url.toNormalform(true, false, true, false), post, usegzip);- } finally {- this.finish();- }- return b;- }/***