From: Bruno Haible Date: Sun, 23 Feb 2020 19:56:32 +0000 (+0100) Subject: urlget: Follow the "privacy by design" principle. X-Git-Tag: v0.21~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8fe23519e66963a2eb837a2c1209ffae8300ddd;p=thirdparty%2Fgettext.git urlget: Follow the "privacy by design" principle. * gettext-tools/src/gnu/gettext/GetURL.java (fetch): Override the User-Agent string, so as not to reveal the Java version to the server. --- diff --git a/gettext-tools/src/gnu/gettext/GetURL.java b/gettext-tools/src/gnu/gettext/GetURL.java index 7ef42d174..af5bd4b28 100644 --- a/gettext-tools/src/gnu/gettext/GetURL.java +++ b/gettext-tools/src/gnu/gettext/GetURL.java @@ -1,5 +1,5 @@ /* Fetch an URL's contents. - * Copyright (C) 2001, 2008 Free Software Foundation, Inc. + * Copyright (C) 2001, 2008, 2020 Free Software Foundation, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,7 +56,10 @@ public class GetURL { }; timeoutThread.start(); try { - InputStream istream = new BufferedInputStream(url.openStream()); + URLConnection connection = url.openConnection(); + // Override the User-Agent string, so as to not reveal the Java version. + connection.setRequestProperty("User-Agent", "urlget"); + InputStream istream = new BufferedInputStream(connection.getInputStream()); OutputStream ostream = new BufferedOutputStream(System.out); for (;;) { int b = istream.read();