--- netsurf-git-180716.old/utils/useragent.c +++ netsurf-git-180716/utils/useragent.c @@ -28,10 +28,6 @@ static const char *core_user_agent_string = NULL; -#ifndef NETSURF_UA_FORMAT_STRING -#define NETSURF_UA_FORMAT_STRING "NetSurf/%d.%d (%s)" -#endif - /** * Prepare core_user_agent_string with a string suitable for use as a * user agent in HTTP requests. @@ -39,34 +35,15 @@ static void user_agent_build_string(void) { - struct utsname un; - const char *sysname = "Unknown"; - char *ua_string; - int len; - - if (uname(&un) >= 0) { - sysname = un.sysname; - } - - len = snprintf(NULL, 0, NETSURF_UA_FORMAT_STRING, - netsurf_version_major, - netsurf_version_minor, - sysname); - ua_string = malloc(len + 1); - if (!ua_string) { - /** \todo this needs handling better */ - return; - } - snprintf(ua_string, len + 1, - NETSURF_UA_FORMAT_STRING, - netsurf_version_major, - netsurf_version_minor, - sysname); - - core_user_agent_string = ua_string; - - NSLOG(netsurf, INFO, "Built user agent \"%s\"", - core_user_agent_string); + char xbuf [256]; + char *xp; + sprintf (xbuf, "NetSurf/%d.%d", + netsurf_version_major, + netsurf_version_minor); + xp = malloc (strlen (xbuf) + 1); + if (xp == NULL) exit (1); + strcpy (xp, xbuf); + core_user_agent_string = xp; } /* This is a function so that later we can override it trivially */