diff options
Diffstat (limited to 'glib/guri.c')
-rw-r--r-- | glib/guri.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/glib/guri.c b/glib/guri.c index 5fa668873..58725503d 100644 --- a/glib/guri.c +++ b/glib/guri.c @@ -25,6 +25,7 @@ #include "glib.h" #include "glibintl.h" +#include "glib-private.h" #include "guriprivate.h" /** @@ -808,8 +809,8 @@ normalize_port (const char *scheme, return port; } -static int -default_scheme_port (const char *scheme) +int +g_uri_get_default_scheme_port (const char *scheme) { if (strcmp (scheme, "http") == 0 || strcmp (scheme, "ws") == 0) return 80; @@ -820,6 +821,9 @@ default_scheme_port (const char *scheme) if (strcmp (scheme, "ftp") == 0) return 21; + if (strstr (scheme, "socks") == scheme) + return 1080; + return -1; } @@ -1019,7 +1023,7 @@ g_uri_split_internal (const gchar *uri_string, } if (port && *port == -1) - *port = default_scheme_port (scheme_str); + *port = g_uri_get_default_scheme_port (scheme_str); } g_free (normalized_scheme); @@ -1760,7 +1764,7 @@ g_uri_join_internal (GUriFlags flags, * * 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 + * 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 @@ -2507,7 +2511,7 @@ g_uri_get_port (GUri *uri) g_return_val_if_fail (uri != NULL, -1); if (uri->port == -1 && uri->flags & G_URI_FLAGS_SCHEME_NORMALIZE) - return default_scheme_port (uri->scheme); + return g_uri_get_default_scheme_port (uri->scheme); return uri->port; } |