mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 07:56:14 +01:00
Merge branch 'uri-path-slashes' into 'master'
guri: Document and check restrictions on path prefixes See merge request GNOME/glib!1612
This commit is contained in:
commit
602b7cca33
14
glib/guri.c
14
glib/guri.c
@ -1347,6 +1347,13 @@ g_uri_join_internal (GUriFlags flags,
|
|||||||
gboolean encoded = (flags & G_URI_FLAGS_ENCODED);
|
gboolean encoded = (flags & G_URI_FLAGS_ENCODED);
|
||||||
GString *str;
|
GString *str;
|
||||||
|
|
||||||
|
/* Restrictions on path prefixes. See:
|
||||||
|
* https://tools.ietf.org/html/rfc3986#section-3
|
||||||
|
*/
|
||||||
|
g_return_val_if_fail (path != NULL, NULL);
|
||||||
|
g_return_val_if_fail (host == NULL || (path[0] == '\0' || path[0] == '/'), NULL);
|
||||||
|
g_return_val_if_fail (host != NULL || (path[0] != '/' || path[1] != '/'), NULL);
|
||||||
|
|
||||||
str = g_string_new (scheme);
|
str = g_string_new (scheme);
|
||||||
if (scheme)
|
if (scheme)
|
||||||
g_string_append_c (str, ':');
|
g_string_append_c (str, ':');
|
||||||
@ -1454,6 +1461,11 @@ g_uri_join_internal (GUriFlags flags,
|
|||||||
* Joins the given components together according to @flags to create
|
* Joins the given components together according to @flags to create
|
||||||
* an absolute URI string. @path may not be %NULL (though it may be "").
|
* an absolute URI string. @path may not be %NULL (though it may be "").
|
||||||
*
|
*
|
||||||
|
* When @host is present, @path must either be empty or begin with a slash (`/`)
|
||||||
|
* character. When @host is not present, @path cannot begin with two slash
|
||||||
|
characters (`//`). See
|
||||||
|
* [RFC 3986, section 3](https://tools.ietf.org/html/rfc3986#section-3).
|
||||||
|
*
|
||||||
* See also g_uri_join_with_user(), which allows specifying the
|
* See also g_uri_join_with_user(), which allows specifying the
|
||||||
* components of the "userinfo" separately.
|
* components of the "userinfo" separately.
|
||||||
*
|
*
|
||||||
@ -1503,7 +1515,7 @@ g_uri_join (GUriFlags flags,
|
|||||||
* an absolute URI string. @path may not be %NULL (though it may be "").
|
* an absolute URI string. @path may not be %NULL (though it may be "").
|
||||||
*
|
*
|
||||||
* In contrast to g_uri_join(), this allows specifying the components
|
* In contrast to g_uri_join(), this allows specifying the components
|
||||||
* of the "userinfo" separately.
|
* of the "userinfo" separately. It otherwise behaves the same.
|
||||||
*
|
*
|
||||||
* Return value: an absolute URI string
|
* Return value: an absolute URI string
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user