to_string
Description:
Returns a string representing this.
If just_path_and_query
is true
, this concatenates the path and query together. That is, it constructs the string that
would be needed in the Request-Line of an HTTP request for this.
Note that the output will never contain a password, even if this does.
Example: Convert a URI to string:
public static int main (string[] args) {
Soup.URI uri = new Soup.URI ("http://username:password@localhost:8088/foo/bar.html?foo=f&bar=b#frag");
// Output: ``http://username@localhost:8088/foo/bar.html?foo=f&bar=b#frag``
string uri_str1 = uri.to_string (false);
print ("%s\n", uri_str1);
// Output: ``/foo/bar.html?foo=f&bar=b``
string uri_str2 = uri.to_string (true);
print ("%s\n", uri_str2);
return 0;
}
valac --pkg libsoup-2.4 uri-to-string.vala
Parameters:
this |
a URI |
just_path_and_query |
if |
Returns:
a string representing this, which the caller must free. |