Module mochiweb_util

Utilities for parsing and quoting.

Copyright © 2007 Mochi Media, Inc.

Authors: Bob Ippolito (bob@mochimedia.com).

Description

Utilities for parsing and quoting.

Function Index

cmd/1os:cmd(cmd_string(Argv)).
cmd_port/2open_port({spawn, mochiweb_util:cmd_string(Argv)}, Options).
cmd_string/1Create a shell quoted command string from a list of arguments.
guess_mime/1 Guess the mime type of a file by the extension of its filename.
join/2Join a list of strings together with the given separator string or char.
parse_header/1 Parse a Content-Type like header, return the main Content-Type and a property list of options.
parse_qs/1Parse a query string or application/x-www-form-urlencoded.
path_split/1Split a path starting from the left, as in URL traversal.
quote_plus/1URL safe encoding of the given term.
shell_quote/1Quote a string according to UNIX shell quoting rules, returns a string surrounded by double quotes.
test/0
unquote/1Unquote a URL encoded string.
urlencode/1URL encode the property list.
urlsplit/1Return a 5-tuple, does not expand % escapes.
urlsplit_path/1Return a 3-tuple, does not expand % escapes.
urlunsplit/1Assemble a URL from the 5-tuple.
urlunsplit_path/1Assemble a URL path from the 3-tuple.

Function Details

cmd/1

cmd(Argv::[string()]) -> string()

os:cmd(cmd_string(Argv)).

cmd_port/2

cmd_port(Argv::[string()], Options) -> port()

open_port({spawn, mochiweb_util:cmd_string(Argv)}, Options).

cmd_string/1

cmd_string(Argv::[string()]) -> string()

Create a shell quoted command string from a list of arguments.

guess_mime/1

guess_mime(File::string()) -> string()

Guess the mime type of a file by the extension of its filename.

join/2

join(Strings::[string()], Separator) -> string()

Join a list of strings together with the given separator string or char.

parse_header/1

parse_header(String::string()) -> {Type, [{K, V}]}

Parse a Content-Type like header, return the main Content-Type and a property list of options.

parse_qs/1

parse_qs(Binary::string() | binary()) -> [{Key, Value}]

Parse a query string or application/x-www-form-urlencoded.

path_split/1

path_split(S::string()) -> {Part, Rest}

Split a path starting from the left, as in URL traversal. path_split("foo/bar") = {"foo", "bar"}, path_split("/foo/bar") = {"", "foo/bar"}.

quote_plus/1

quote_plus(Atom::atom() | integer() | string()) -> string()

URL safe encoding of the given term.

shell_quote/1

shell_quote(L::string()) -> string()

Quote a string according to UNIX shell quoting rules, returns a string surrounded by double quotes.

test/0

test() -> term()

unquote/1

unquote(Binary::string() | binary()) -> string()

Unquote a URL encoded string.

urlencode/1

urlencode(Props::[{Key, Value}]) -> string()

URL encode the property list.

urlsplit/1

urlsplit(Url) -> {Scheme, Netloc, Path, Query, Fragment}

Return a 5-tuple, does not expand % escapes. Only supports HTTP style URLs.

urlsplit_path/1

urlsplit_path(Path::Url) -> {Path, Query, Fragment}

Return a 3-tuple, does not expand % escapes. Only supports HTTP style paths.

urlunsplit/1

urlunsplit(X1::{Scheme, Netloc, Path, Query, Fragment}) -> string()

Assemble a URL from the 5-tuple. Path must be absolute.

urlunsplit_path/1

urlunsplit_path(X1::{Path, Query, Fragment}) -> string()

Assemble a URL path from the 3-tuple.


Generated by EDoc, Aug 9 2007, 13:32:58.