--- netsurf-browser-git-250225.old/utils/useragent.c +++ netsurf-browser-git-250225/utils/useragent.c @@ -29,10 +29,6 @@ static const char *core_user_agent_string = NULL; -#ifndef NETSURF_UA_FORMAT_STRING -#define NETSURF_UA_FORMAT_STRING "Mozilla/5.0 (%s) NetSurf/%d.%d" -#endif - /** * Prepare core_user_agent_string with a string suitable for use as a * user agent in HTTP requests. @@ -40,38 +36,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; - if (strcmp(sysname, "Linux") == 0) { - /* Force desktop, not mobile */ - sysname = "X11; Linux"; - } - } - - len = snprintf(NULL, 0, NETSURF_UA_FORMAT_STRING, - sysname, - netsurf_version_major, - netsurf_version_minor); - ua_string = malloc(len + 1); - if (!ua_string) { - /** \todo this needs handling better */ - return; - } - snprintf(ua_string, len + 1, - NETSURF_UA_FORMAT_STRING, - sysname, - netsurf_version_major, - netsurf_version_minor); - - 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 */