Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2005:
[Freeciv-Dev] (PR#12871) Modify User-Agent string format
Home

[Freeciv-Dev] (PR#12871) Modify User-Agent string format

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12871) Modify User-Agent string format
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Fri, 22 Apr 2005 16:26:34 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12871 >

This patch fixes issues we have with machine or OS names with spaces
embedded with them. It changes the format from:

User-Agent: Freeciv/2.0.0 gui-gtk-2.0 Darwin 1.2 [Power Macintosh]

to:

User-Agent: Freeciv/2.0.0 (gui-gtk-2.0; Darwin; 1.2; Power Macintosh)

Which is easier to parse and not bug prone.

This is used for when you connect to the metaserver web page.

Index: client/clinet.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/clinet.c,v
retrieving revision 1.115
diff -u -u -r1.115 clinet.c
--- client/clinet.c     15 Apr 2005 20:24:43 -0000      1.115
+++ client/clinet.c     22 Apr 2005 23:17:43 -0000
@@ -489,8 +489,8 @@
       break;
   }
   my_snprintf(uname_buf, sizeof(uname_buf),
-             "%s %ld.%ld [%s]", osname, osvi.dwMajorVersion, 
osvi.dwMinorVersion,
-             cpuname);
+             "%s; %ld.%ld; %s",
+             osname, osvi.dwMajorVersion, osvi.dwMinorVersion, cpuname);
   return uname_buf;
 }
 #endif
@@ -617,7 +617,7 @@
 #ifdef HAVE_UNAME
   uname(&un);
   my_snprintf(machine_string,sizeof(machine_string),
-              "%s %s [%s]",
+              "%s; %s; %s",
               un.sysname,
               un.release,
               un.machine);
@@ -628,7 +628,7 @@
   sz_strlcpy(machine_string,win_uname());
 #else
   my_snprintf(machine_string,sizeof(machine_string),
-              "unknown unknown [unknown]");
+              "unknown; unknown; unknown");
 #endif
 #endif /* HAVE_UNAME */
 
@@ -637,7 +637,7 @@
   my_snprintf(str, sizeof(str),
     "POST %s HTTP/1.1\r\n"
     "Host: %s:%d\r\n"
-    "User-Agent: Freeciv/%s %s %s\r\n"
+    "User-Agent: Freeciv/%s (%s; %s)\r\n"
     "Connection: close\r\n"
     "Content-Type: application/x-www-form-urlencoded; charset=\"utf-8\"\r\n"
     "Content-Length: %lu\r\n"

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12871) Modify User-Agent string format, Vasco Alexandre da Silva Costa <=