Types/fns concerning URLs (see RFC 3986)

Type Query

type Query = ~[(~str, ~str)]

Type UserInfo

type UserInfo = {user: ~str, pass: Option<~str>,}

Enum Input

Variants

Struct Url

struct Url {
    scheme: ~str,
    user: Option<UserInfo>,
    host: ~str,
    port: Option<~str>,
    path: ~str,
    query: Query,
    fragment: Option<~str>,
}

Implementation of Eq for UserInfo

Method eq

fn eq(other: & UserInfo) -> bool

Method ne

fn ne(other: & UserInfo) -> bool

Implementation of Eq for Input

Method eq

fn eq(other: & Input) -> bool

Method ne

fn ne(other: & Input) -> bool

Implementation of FromStr for Url

Method from_str

fn from_str(s: & str) -> Option<Url>

Implementation of to_str::ToStr for Url

Method to_str

fn to_str() -> ~str

Implementation of Eq for Url

Method eq

fn eq(other: & Url) -> bool

Method ne

fn ne(other: & Url) -> bool

Implementation of IterBytes for Url

Method iter_bytes

fn iter_bytes(lsb0: bool, f: to_bytes::Cb)

Function Url

fn Url(scheme: ~str, user: Option<UserInfo>, host: ~str, port: Option<~str>,
       path: ~str, query: Query, fragment: Option<~str>) -> Url

Function UserInfo

fn UserInfo(user: ~str, pass: Option<~str>) -> UserInfo

Function decode

fn decode(s: & str) -> ~str

Decode a string encoded with percent encoding.

This will only decode escape sequences generated by encode_uri.

Function decode_component

fn decode_component(s: & str) -> ~str

Decode a string encoded with percent encoding.

Function decode_form_urlencoded

fn decode_form_urlencoded(s: ~[u8]) -> map::HashMap<~str, @dvec::DVec<@~str>>

Decode a string encoded with the 'application/x-www-form-urlencoded' media type into a hashmap.

Function decode_inner

fn decode_inner(s: & str, full_url: bool) -> ~str

Function encode

fn encode(s: & str) -> ~str

Encodes a URI by replacing reserved characters with percent encoded character sequences.

This function is compliant with RFC 3986.

Function encode_component

fn encode_component(s: & str) -> ~str

Encodes a URI component by replacing reserved characters with percent encoded character sequences.

This function is compliant with RFC 3986.

Function encode_form_urlencoded

fn encode_form_urlencoded(m: HashMap<~str, @DVec<@~str>>) -> ~str

Encode a hashmap to the 'application/x-www-form-urlencoded' media type.

Function encode_inner

fn encode_inner(s: & str, full_url: bool) -> ~str

Function encode_plus

fn encode_plus(s: & str) -> ~str

Function from_str

fn from_str(rawurl: & str) -> result::Result<Url, ~str>

Parse a str to a url

Arguments

rawurl - a string representing a full url, including scheme.

Returns

a url that contains the parsed representation of the url.

Function get_authority

fn get_authority(rawurl: & str) ->
   result::Result<(Option<UserInfo>, ~str, Option<~str>, ~str), @~str>

Function get_path

fn get_path(rawurl: & str, authority: bool) ->
   result::Result<(~str, ~str), @~str>

Function get_query_fragment

fn get_query_fragment(rawurl: & str) ->
   result::Result<(Query, Option<~str>), @~str>

Function get_scheme

fn get_scheme(rawurl: & str) -> result::Result<(~str, ~str), @~str>

Function query_from_str

fn query_from_str(rawquery: & str) -> Query

Function query_to_str

fn query_to_str(query: Query) -> ~str

Function split_char_first

fn split_char_first(s: & str, c: char) -> (~str, ~str)

Function to_str

fn to_str(url: Url) -> ~str

Format a url as a string

Arguments

url - a url.

Returns

a str that contains the formatted url. Note that this will usually be an inverse of from_str but might strip out unneeded separators. for example, "http://somehost.com?", when parsed and formatted, will result in just "http://somehost.com".

Function userinfo_from_str

fn userinfo_from_str(uinfo: & str) -> UserInfo

Function userinfo_to_str

fn userinfo_to_str(userinfo: UserInfo) -> ~str