Browse Source

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`.
Ryan Ernst 9 years ago
parent
commit
293a24e8e8

+ 1 - 0
core/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java

@@ -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