1PMHTTPNEWCLIENT(3) Library Functions Manual PMHTTPNEWCLIENT(3)
2
3
4
6 pmhttpNewClient, pmhttpFreeClient, pmhttpClientFetch - simple HTTP
7 client interfaces
8
10 #include <pcp/pmapi.h>
11 #include <pcp/pmhttp.h>
12
13 struct http_client *pmhttpNewClient(void);
14 void pmhttpFreeClient(struct http_client *client);
15 int pmhttpClientFetch(struct http_client *client, const char *url, char
16 *bodybuf, size_t bodylen, char *typebuf, size_t typelen);
17
18 cc ... -lpcp_web
19
21 pmhttpNewClient allocates and initializes an opaque HTTP client that is
22 ready to make requests from a server.
23
24 The URL request interface pmhttpClientFetch issues an HTTP GET request
25 to the server specified in the supplied url. The body of the response
26 is returned in the caller supplied bodybuf buffer, of bodylen bytes
27 length. An optional typebuf buffer, of typelen bytes length, can also
28 be supplied and (if non-NULL) will contain the value of the content-
29 type header returned from the server.
30
31 The url parameter is an RFC1630 format URL. This will typically be
32 prefixed with "http://", however these interfaces also support Unix do‐
33 main sockets. Those are instead prefixed by "unix://", followed by the
34 full filesystem path to the desired Unix domain socket.
35
36 To free up resources associated with an HTTP client, including closing
37 any persistent server connection that has been established earlier, is
38 accomplished using the pmhttpFreeClient routine.
39
41 pmhttpNewClient will return NULL on failure, which can only occur when
42 allocation of memory is not possible.
43
44 pmhttpClientFetch will return the number of bytes places into the body‐
45 buf buffer, else a negated error code indicating the nature of the
46 failure.
47
49 pmdaapache(1), pmjsonInit(3), PMAPI(3), PMWEBAPI(3) and
50 https://tools.ietf.org/html/rfc1630.
51
52
53
54Performance Co-Pilot PCP PMHTTPNEWCLIENT(3)