[PLUGINS] Always send current ES version when downloading plugins

to enable download servers to send the correct plugin version for the
node that is installing it this PR sends the current version as a header
to the server.
This commit is contained in:
Simon Willnauer 2015-03-17 16:28:37 -07:00
parent e49aa2dee8
commit 9554e509e3
1 changed files with 4 additions and 0 deletions

View File

@ -21,6 +21,7 @@ package org.elasticsearch.common.http.client;
import org.apache.lucene.util.IOUtils;
import org.elasticsearch.ElasticsearchTimeoutException;
import org.elasticsearch.Version;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.unit.TimeValue;
@ -277,6 +278,9 @@ public class HttpDownloadHelper {
((HttpURLConnection) connection).setUseCaches(true);
((HttpURLConnection) connection).setConnectTimeout(5000);
}
connection.setRequestProperty("ES-Version", Version.CURRENT.toString());
connection.setRequestProperty("User-Agent", "elasticsearch-plugin-manager");
// connect to the remote site (may take some time)
connection.connect();