mirror of
https://github.com/bdnugget/kcgi.git
synced 2026-11-07 05:47:27 +00:00
65 lines
1.7 KiB
Plaintext
65 lines
1.7 KiB
Plaintext
.\" $Id$
|
|
.\"
|
|
.\" Copyright (c) 2014, 2017, 2020 Kristaps Dzonsons <kristaps@bsd.lv>
|
|
.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
|
|
.\"
|
|
.\" Permission to use, copy, modify, and distribute this software for any
|
|
.\" purpose with or without fee is hereby granted, provided that the above
|
|
.\" copyright notice and this permission notice appear in all copies.
|
|
.\"
|
|
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
.\"
|
|
.Dd $Mdocdate$
|
|
.Dt KHTTP_URLENCODE 3
|
|
.Os
|
|
.Sh NAME
|
|
.Nm khttp_urlencode
|
|
.Nd URL encoding for kcgi
|
|
.Sh LIBRARY
|
|
.Lb libkcgi
|
|
.Sh SYNOPSIS
|
|
.In sys/types.h
|
|
.In stdarg.h
|
|
.In stdint.h
|
|
.In kcgi.h
|
|
.Ft "char *"
|
|
.Fo khttp_urlencode
|
|
.Fa "const char *cp"
|
|
.Fc
|
|
.Sh DESCRIPTION
|
|
Percent-encodes a string
|
|
.Fa cp ,
|
|
usually for embedding in a URL, and returns the allocated result.
|
|
If passed a
|
|
.Dv NULL ,
|
|
returns an allocated empty string.
|
|
.Pp
|
|
The encoding uses capital-letter hex encoding.
|
|
.Sh RETURN VALUES
|
|
Returns a newly-allocated string that must be freed with
|
|
.Xr free 3
|
|
or
|
|
.Dv NULL
|
|
if allocation fails.
|
|
.Pp
|
|
The deprecated form of this function,
|
|
.Fn kutil_urlencode ,
|
|
should no longer be used.
|
|
.Sh EXAMPLES
|
|
The following table shows strings pre- and post-encoding.
|
|
.Pp
|
|
.TS
|
|
l l.
|
|
foo bar foo+bar
|
|
foo+bar foo%2Bbar
|
|
.TE
|
|
.Sh AUTHORS
|
|
Written by
|
|
.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
|