YaST2 Developers Documentation: yast2

yast2

modules/URL.ycp
Manipulate and Parse URLs

This module has an unstable interface.

Imports

  • Hostname
  • IP
  • String

Global Variables

Global Functions

Info:

TODO: - read URI(3) - esp. compare the regex mentioned in the URI(3) with ours: my($scheme, $authority, $path, $query, $fragment) = $uri =~ m|^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?|;

global transform_map_passwd -> map<string, string>

Transform map used for (un)escaping characters in username/password part of an URL. It doesn't contain '%' because this character must be used in a particular order (the first or the last) during processing

global transform_map_filename -> map<string, string>

Transform map used for (un)escaping characters in file location part of an URL. It doesn't contain '%' because this character must be used in a particular order (the first or the last) during processing

global transform_map_query -> map<string, string>

Transform map used for (un)escaping characters in query part of a URL. It doesn't contain '%' because this character must be used in a particular order (the first or the last) during processing

global UnEscapeString (string in, map<string,string> transform) -> string

Escape reserved characters in string used as a part of URL (e.g. '%' => '%25', '@' => '%40'...)

Parameters:
in input string to escape
transform
Return value:
escaped string
global EscapeString (string in, map<string,string> transform) -> string

Escape reserved characters in string used as a part of URL (e.g. '%' => '%25', '@' => '%40'...)

Parameters:
in input string to escape
transform
Return value:
escaped string
global Parse (string url) -> map

Tokenize URL

Parameters:
url URL to be parsed
Return value:
URL split to tokens
Example
 Parse("http://name:pass@www.suse.cz:80/path/index.html?question#part") ->
     $[
         "scheme"  : "http",
         "host"    : "www.suse.cz"
         "port"    : "80",
         "path"    : /path/index.html",
         "user"    : "name",
         "pass"    : "pass",
         "query"   : "question",
         "fragment": "part"
     ]
global Check (string url) -> boolean

Check URL

Parameters:
url URL to be checked
Return value:
true if correct
See
RFC 2396 (updated by RFC 2732) also perl-URI: URI(3)
global Build (map tokens) -> string

Build URL from tokens as parsed with Parse

Parameters:
tokens
Return value:
url, empty string if invalid data is used to build the url.
See
RFC 2396 (updated by RFC 2732) also perl-URI: URI(3)