pmhttpnewclient(3) — Linux manual page

NAME | C SYNOPSIS | DESCRIPTION | DIAGNOSTICS | SEE ALSO | COLOPHON

PMHTTPNEWCLIENT(3)      Library Functions Manual      PMHTTPNEWCLIENT(3)

NAME         top

       pmhttpNewClient, pmhttpFreeClient, pmhttpClientFetch - simple
       HTTP client interfaces

C SYNOPSIS         top

       #include <pcp/pmapi.h>
       #include <pcp/pmhttp.h>

       struct http_client *pmhttpNewClient(void);
       void pmhttpFreeClient(struct http_client *client);
       int pmhttpClientFetch(struct http_client *client, const char
               *url, char *bodybuf, size_t bodylen, char *typebuf,
               size_t typelen);

       cc ... -lpcp_web

DESCRIPTION         top

       pmhttpNewClient allocates and initializes an opaque HTTP client
       that is ready to make requests from a server.

       The URL request interface pmhttpClientFetch issues an HTTP GET
       request to the server specified in the supplied url.  The body of
       the response is returned in the caller supplied bodybuf buffer,
       of bodylen bytes length.  An optional typebuf buffer, of typelen
       bytes length, can also be supplied and (if non-NULL) will contain
       the value of the content-type header returned from the server.

       The url parameter is an RFC1630 format URL.  This will typically
       be prefixed with "http:https://", however these interfaces also support
       Unix domain sockets.  Those are instead prefixed by "unix:https://",
       followed by the full filesystem path to the desired Unix domain
       socket.

       To free up resources associated with an HTTP client, including
       closing any persistent server connection that has been
       established earlier, is accomplished using the pmhttpFreeClient
       routine.

DIAGNOSTICS         top

       pmhttpNewClient will return NULL on failure, which can only occur
       when allocation of memory is not possible.

       pmhttpClientFetch will return the number of bytes places into the
       bodybuf buffer, else a negated error code indicating the nature
       of the failure.

SEE ALSO         top

       pmdaapache(1), pmjsonInit(3), PMAPI(3), PMWEBAPI(3) and
       https://tools.ietf.org/html/rfc1630 .

COLOPHON         top

       This page is part of the PCP (Performance Co-Pilot) project.
       Information about the project can be found at 
       ⟨http:https://www.pcp.io/⟩.  If you have a bug report for this manual
       page, send it to [email protected].  This page was obtained from the
       project's upstream Git repository
       ⟨https://github.com/performancecopilot/pcp.git⟩ on 2023-12-22.
       (At that time, the date of the most recent commit that was found
       in the repository was 2023-12-16.)  If you discover any rendering
       problems in this HTML version of the page, or you believe there
       is a better or more up-to-date source for the page, or you have
       corrections or improvements to the information in this COLOPHON
       (which is not part of the original manual page), send a mail to
       [email protected]

Performance Co-Pilot               PCP                PMHTTPNEWCLIENT(3)