Complete.Org: Mailing Lists: Archives: freeciv-dev: December 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" <vasco.costa@xxxxxxxxx>
Date: Sat, 3 Dec 2005 08:16:44 -0800
Reply-to: bugs@xxxxxxxxxxx

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

> [vasc - Fri Apr 22 23:26:33 2005]:
> 
> 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.

Here is an updated patch to current SVN trunk.

Index: client/servers.c
===================================================================
--- client/servers.c    (revision 11294)
+++ client/servers.c    (working copy)
@@ -256,7 +256,7 @@
       break;
   }
   my_snprintf(uname_buf, sizeof(uname_buf),
-             "%s %ld.%ld [%s]", osname, osvi.dwMajorVersion, 
osvi.dwMinorVersion,
+             "%s; %ld.%ld; %s", osname, osvi.dwMajorVersion, 
osvi.dwMinorVersion,
              cpuname);
   return uname_buf;
 }
@@ -277,7 +277,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);
@@ -288,7 +288,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 */
 
@@ -297,7 +297,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 <=