/* 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
};
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();