From ce6230c4060eb099accc315bd3f6ff88813d2e7b Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 27 Jun 2004 19:36:01 +0000 Subject: [PATCH] Connection.java (userAgent): New static final field. * gnu/java/net/protocol/http/Connection.java (userAgent): New static final field. (sendRequest): Use new field in user-agent http agent. From-SVN: r83741 --- libjava/ChangeLog | 6 ++++++ libjava/gnu/java/net/protocol/http/Connection.java | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 71ab0bfc1af..ae95f7b034a 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,9 @@ +2004-06-27 Mark Wielaard + + * gnu/java/net/protocol/http/Connection.java (userAgent): New static + final field. + (sendRequest): Use new field in user-agent http agent. + 2004-06-27 Mark Wielaard * java/awt/EventQueue.java (postEvent): Throw NullPointerException diff --git a/libjava/gnu/java/net/protocol/http/Connection.java b/libjava/gnu/java/net/protocol/http/Connection.java index ac369f4ee6e..44239e1721a 100644 --- a/libjava/gnu/java/net/protocol/http/Connection.java +++ b/libjava/gnu/java/net/protocol/http/Connection.java @@ -80,6 +80,8 @@ public final class Connection extends HttpURLConnection private static boolean proxyInUse = false; private static String proxyHost = null; + private static final String userAgent; + static { // Recognize some networking properties listed at @@ -101,6 +103,14 @@ public final class Connection extends HttpURLConnection } } } + + userAgent = "gnu-classpath/" + + System.getProperty("gnu.classpath.version") + + " (" + + System.getProperty("gnu.classpath.vm.shortname") + + "/" + + System.getProperty("java.vm.version") + + ")"; } /** @@ -215,8 +225,7 @@ public final class Connection extends HttpURLConnection setRequestProperty ("Connection", "Close"); if (getRequestProperty ("user-agent") == null) - setRequestProperty ("user-agent", "gnu-libgcj/" - + System.getProperty ("java.vm.version")); + setRequestProperty ("user-agent", userAgent); if (getRequestProperty ("accept") == null) setRequestProperty ("accept", "*/*");