NetSurf
Macros | Functions | Variables
useragent.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "utils/config.h"
#include "utils/utsname.h"
#include "desktop/version.h"
#include "utils/log.h"
#include "utils/useragent.h"
Include dependency graph for useragent.c:

Go to the source code of this file.

Macros

#define NETSURF_UA_FORMAT_STRING   "Mozilla/5.0 (%s) NetSurf/%d.%d"
 

Functions

static void user_agent_build_string (void)
 Prepare core_user_agent_string with a string suitable for use as a user agent in HTTP requests. More...
 
const char * user_agent_string (void)
 Retrieve the core user agent for this release. More...
 
void free_user_agent_string (void)
 Free any memory allocated for the user_agent_string. More...
 

Variables

static const char * core_user_agent_string = NULL
 

Macro Definition Documentation

◆ NETSURF_UA_FORMAT_STRING

#define NETSURF_UA_FORMAT_STRING   "Mozilla/5.0 (%s) NetSurf/%d.%d"

Definition at line 33 of file useragent.c.

Function Documentation

◆ free_user_agent_string()

void free_user_agent_string ( void  )

Free any memory allocated for the user_agent_string.

After calling this, the value returned by user_agent_string() is to be considered invalid.

Definition at line 88 of file useragent.c.

References core_user_agent_string.

Referenced by netsurf_exit().

Here is the caller graph for this function:

◆ user_agent_build_string()

static void user_agent_build_string ( void  )
static

Prepare core_user_agent_string with a string suitable for use as a user agent in HTTP requests.

Todo:
this needs handling better

Definition at line 41 of file useragent.c.

References core_user_agent_string, NETSURF_UA_FORMAT_STRING, netsurf_version_major, netsurf_version_minor, NSLOG, utsname::sysname, and uname().

Referenced by user_agent_string().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ user_agent_string()

const char * user_agent_string ( void  )

Retrieve the core user agent for this release.

The string returned can be relied upon to exist for the duration of the execution of the program. There is no need to copy it.

Definition at line 79 of file useragent.c.

References core_user_agent_string, and user_agent_build_string().

Referenced by atari_about_show(), fetch_curl_register(), and nsbeos_about().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ core_user_agent_string

const char* core_user_agent_string = NULL
static

Definition at line 30 of file useragent.c.

Referenced by free_user_agent_string(), user_agent_build_string(), and user_agent_string().