http_setUserAgent(3)

http_setUserAgent3

Changes the user agent shown to the server during an http get request.

Usage

#include <http_fetcher.h>

int http_setUserAgent(const char *newAgent);

Overview

The User Agent field of an HTTP request tells the server what software is making the request. By default, "HTTP Fetcher/VERSION" is sent.

Calling http_setUserAgent will change the default User Agent to newAgent for subsequent requests (until the next call to http_setUserAgent).

If you pass in NULL as an argument, HTTP Fetcher will NOT give the server a User Agent.

This function is useful for mimicing a browser, deceiving the webserver, or a number of other creative uses.

Return value

On success, http_setUserAgent returns 0.

On error, -1 is returned, and the previous value of
userAgent is unchanged. http_perror can be used to print an informative error message. http_strerror can be used to get a pointer to the current error description message.

Releases

Unchanged in 2 releases since Debian 3.0 (Woody).

  1. 3.0–3.1

From libhttpfetcher-dev 1.0.1-3 in Debian 3.1 (Sarge). Parsed by carta from the page's man source.