GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  KUTIL_URLENCODE (3)

NAME

kutil_urlabs, kutil_urlpart, kutil_urlpartx, kutil_urlencode - URL functions for kcgi

CONTENTS

Library
Synopsis
Description
Return Values
Authors
Caveats

LIBRARY


.Lb libkcgi

SYNOPSIS


.In stdint.h
.In kcgi.h char *
.Fo kutil_urlabs enum kscheme scheme const char *host uint16_t port const char *path
.Fc char *
.Fo kutil_urlpart struct kreq *req const char *path const char *suffix const char *page ...
.Fc char *
.Fo kutil_urlpartx struct kreq *req const char *path const char *suffix const char *page ...
.Fc char * kutil_urlencode const char *cp

DESCRIPTION

The kutil_urlpart, and kutil_urlpartx functions format a partial HTTP URL from the path, suffix, page, and variable-length query string keys and values. If the suffix part is NULL, it is not formatted as part of the URL. The kutil_urlabs forms an absolute URL from a scheme, domain, and path component. The kutil_urlencode function encodes a string for embedding in a URL. All functions return newly-allocated string of the encoded contents.

kutil_urlpart and kutil_urlpartx accept variable-length arguments terminated with a NULL value. kutil_urlpart accepts key-value string pairs. kutil_urlpartx accepts string keys, then a
.Vt enum kattrx of the value type, then a pointer to the value corresponding to that type: KATTRX_STRING for strings, KATTRX_INT for
.Vt int64_t 64-bit signed integers, and KATTRX_DOUBLE for
.Vt double double-precision floating-point numbers. kutil_urlpart, thus, is as if kutil_urlpartx were invoked with KATTRX_STRING for all values.

kutil_urlabs formats schema, host, port, and path component into a URL. This is not URL-encoded in any way, so make sure to use kutil_urlpart, kutil_urlpartx, or just kutil_urlencode for the sensitive parts.

RETURN VALUES

kutil_urlabs, kutil_urlpart, kutil_urlpartx, and kutil_urlencode return a newly-allocated string that must be freed with free(3). kutil_urlencode will return NULL if its input argument is NULL or if allocation fails.

AUTHORS

The kutil_urlabs library was written by
.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .

CAVEATS

The kutil_urlabs function accepts schemas via
.Vt enum kscheme that aren’t URLs.

Also, the fact that kutil_urlencode will return NULL on allocation failure but kutil_urlabs, kutil_urlpart, and kutil_urlpartx will abort is wrong.

Search for    or go to Top of page |  Section 3 |  Main Index


Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.