License:
BSD style: see license.txt

Version:
Initial release: April 2004

author:
Kris

  • char* memchr (char*, char, uint);
  • external links

  • class Uri : tango.net.model.UriView.UriView;
  • Implements an RFC 2396 compliant URI specification. See this page for more information.

    The implementation fails the spec on two counts: it doesn't insist on a scheme being present in the Uri , and it doesn't implement the "Relative References" support noted in section 5.2. The latter can be found in tango.util.PathUtil instead.

    Note that IRI support can be implied by assuming each of userinfo, path, query, and fragment are UTF-8 encoded (see this page for further details).

    Use the UriView subset where you need a readonly perspective.


  • this();
  • Create an empty Uri

  • this(char[] uri);
  • Construct a Uri from the provided character string

  • this(char[] scheme, char[] host, char[] path, char[] query = null);
  • Construct a Uri from the given components. The query is optional.

  • this(UriView other);
  • Clone another Uri. This can be used to make a mutable Uri from an immutable UriView.

  • final int getDefaultPort (char[] scheme);
  • Return the default port for the given scheme. InvalidPort is returned if the scheme is unknown, or does not accept a port.

  • final char[] getScheme ();
  • Return the parsed scheme, or null if the scheme was not specified

  • final char[] getHost ();
  • Return the parsed host, or null if the host was not specified

  • final int getPort ();
  • Return the parsed port number, or InvalidPort if the port was not provided.

  • final int getValidPort ();
  • Return a valid port number by performing a lookup on the known schemes if the port was not explicitly specified.

  • final char[] getUserInfo ();
  • Return the parsed userinfo, or null if userinfo was not provided.

  • final char[] getPath ();
  • Return the parsed path, or null if the path was not provided.

  • final char[] getQuery ();
  • Return the parsed query, or null if a query was not provided.

  • final char[] getFragment ();
  • Return the parsed fragment, or null if a fragment was not provided.

  • final bool isGeneric ();
  • Return whether or not the Uri scheme is considered generic.

  • final void delegate(void[]) produce (void delegate(void[]) consume);
  • Emit the content of this Uri via the provided Consumer. The output is constructed per RFC 2396.

  • final char[] toString ();
  • Emit the content of this Uri via the provided Consumer. The output is constructed per RFC 2396.

  • static void delegate(void[]) encode (void delegate(void[]) consume, char[] s, int flags);
  • Encode uri characters into a Consumer, such that reserved chars are converted into their %hex version.

  • static final char[] encode (char[] text, int flags);
  • Encode uri characters into a string, such that reserved chars are converted into their %hex version.

    Returns a dup'd string



  • final char[] decode (char[] s);
  • Decode a duplicated string with potential %hex values in it

  • final Uri parse (char[] uri, bool relative = false);
  • Parsing is performed according to RFC 2396

                      ^(([^:/?#]+):)?(//([^/?#]*)?([^?#]*)(\?([^#]*))?(#(.*))?
    )                   12            3  4          5       6  7        8 9
    
                    2 isolates scheme
                    4 isolates authority
                    5 isolates path
                    7 isolates query
                    9 isolates fragment
    
    This was originally a state-machine; it turned out to be a lot faster (~40%) when unwound like this instead.



  • final void reset ();
  • Clear everything to null.

  • final Uri relParse (char[] uri);
  • Parse the given uri, with support for relative URLs

  • final Uri setScheme (char[] scheme);
  • Set the Uri scheme

  • final Uri setHost (char[] host);
  • Set the Uri host

  • final Uri setPort (int port);
  • Set the Uri port

  • final Uri setUserInfo (char[] userinfo);
  • Set the Uri userinfo

  • final Uri setQuery (char[] query);
  • Set the Uri query

  • final char[] extendQuery (char[] tail);
  • Extend the Uri query

  • final Uri setPath (char[] path);
  • Set the Uri path

  • final Uri setFragment (char[] fragment);
  • Set the Uri fragment

    Copyright (c) 2004 Kris Bell. All rights reserved :: page rendered by CandyDoc