Plugins: Add back user agent when downloading plugins (#20872)

This adds back a User-Agent header, which we had before large plugin
script refactorings for 5.0. The value is now
`elasticsearch-plugin-installer`.
This commit is contained in:
Ryan Ernst 2016-10-18 18:36:16 -07:00 committed by GitHub
parent 38c650f376
commit 293a24e8e8
1 changed files with 1 additions and 0 deletions

View File

@ -269,6 +269,7 @@ class InstallPluginCommand extends SettingCommand {
URL url = new URL(urlString);
Path zip = Files.createTempFile(tmpDir, null, ".zip");
URLConnection urlConnection = url.openConnection();
urlConnection.addRequestProperty("User-Agent", "elasticsearch-plugin-installer");
int contentLength = urlConnection.getContentLength();
try (InputStream in = new TerminalProgressInputStream(urlConnection.getInputStream(), contentLength, terminal)) {
// must overwrite since creating the temp file above actually created the file