|
NAMEkhttp_urlabs , khttp_vurlabs
—
URL formatting for kcgi
LIBRARYlibrary “libkcgi”SYNOPSIS#include <sys/types.h>
#include <stdarg.h>
#include <stdint.h>
#include <kcgi.h>
char *
char *
DESCRIPTIONFormat an absolute (full) URL. The host is in some standards called the “authority”.scheme://host:port/path?key=val scheme://host:port/path scheme:path Passing a If the host is non-empty and not
If the port is zero, it is omitted. The
port is only used if host is
non-empty and not The variable arguments are arranged in pairs terminated by a
single Only the query string pairs are URL-encoded, so the caller must make sure that the characters in host and path are valid. The deprecated form of these functions,
RETURN VALUESReturn newly-allocated strings that must be freed with free(3) orNULL if allocation fails.
EXAMPLESTo print a full URL:khttp_urlabs(KSCHEME_HTTPS, foo.com,
80, b, c, d, NULL); This assigns Setting the port to zero eliminates the port: khttp_urlabs(KSCHEME_HTTPS, foo.com,
0, b, c, d, NULL); This assigns An empty path component ends with the domain (or query string). khttp_urlabs(KSCHEME_HTTPS, foo.com,
0, , c, d, NULL); This assigns To use a host-less scheme, specify a khttp_urlabs(KSCHEME_MAILTO, NULL, 0,
k@b.com, NULL); This assigns AUTHORSWritten by Kristaps Dzonsons <kristaps@bsd.lv>.CAVEATSThese functions can currently be used to create semantically invalid URLs such ashttps:?foo=bar by omitting components required for
the scheme. Semantically-correct URLs are the responsibility of the caller.
This behaviour may be verified for correctness in later versions of the
software.
Visit the GSP FreeBSD Man Page Interface. |