This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: Better http connection user-agent string


Hi,

This solves a silly divergence between GNU Classpath and libgcj.

2004-06-27  Mark Wielaard  <mark@klomp.org>

       * gnu/java/net/protocol/http/Connection.java (userAgent): New static
       final field.
       (sendRequest): Use new field in user-agent http agent.

Committed.

Cheers,

Mark
Index: gnu/java/net/protocol/http/Connection.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/net/protocol/http/Connection.java,v
retrieving revision 1.15
diff -u -r1.15 Connection.java
--- gnu/java/net/protocol/http/Connection.java	27 Jan 2004 21:05:29 -0000	1.15
+++ gnu/java/net/protocol/http/Connection.java	27 Jun 2004 19:33:28 -0000
@@ -80,6 +80,8 @@
   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 @@
 	      }
 	  }
       }
+
+    userAgent = "gnu-classpath/"
+      + System.getProperty("gnu.classpath.version")
+      + " ("
+      + System.getProperty("gnu.classpath.vm.shortname")
+      + "/"
+      + System.getProperty("java.vm.version")
+      + ")";
   }
 
   /**
@@ -215,8 +225,7 @@
       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", "*/*");

Attachment: signature.asc
Description: This is a digitally signed message part


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]