[libsoup/pgriffis/port-normalized: 3/3] Remove soup_uri_get_port_with_default()
- From: Patrick Griffis <pgriffis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup/pgriffis/port-normalized: 3/3] Remove soup_uri_get_port_with_default()
- Date: Tue, 1 Dec 2020 21:30:23 +0000 (UTC)
commit 01f6bfa2b3aa250aea799bd75e777861fd1a6ec7
Author: Patrick Griffis <pgriffis igalia com>
Date: Sat Nov 28 12:04:26 2020 -0600
Remove soup_uri_get_port_with_default()
The latest GLib handles this for us
docs/reference/libsoup-3.0-sections.txt | 2 --
libsoup/auth/soup-auth-digest.c | 2 +-
libsoup/hsts/soup-hsts-enforcer.c | 2 +-
libsoup/soup-connection.c | 4 ++--
libsoup/soup-session.c | 2 +-
libsoup/soup-uri-utils.c | 32 ++------------------------------
libsoup/soup-uri-utils.h | 4 +---
7 files changed, 8 insertions(+), 40 deletions(-)
---
diff --git a/docs/reference/libsoup-3.0-sections.txt b/docs/reference/libsoup-3.0-sections.txt
index 01dff225..a083c5c5 100644
--- a/docs/reference/libsoup-3.0-sections.txt
+++ b/docs/reference/libsoup-3.0-sections.txt
@@ -516,8 +516,6 @@ SOUP_HTTP_URI_FLAGS
<SUBSECTION>
soup_uri_decode_data_uri
<SUBSECTION>
-soup_uri_get_port_with_default
-<SUBSECTION>
SoupURIComponent
soup_uri_copy
</SECTION>
diff --git a/libsoup/auth/soup-auth-digest.c b/libsoup/auth/soup-auth-digest.c
index 76922929..adbbffe5 100644
--- a/libsoup/auth/soup-auth-digest.c
+++ b/libsoup/auth/soup-auth-digest.c
@@ -211,7 +211,7 @@ soup_auth_digest_get_protection_space (SoupAuth *auth, GUri *source_uri)
uri = g_uri_parse (d, SOUP_HTTP_URI_FLAGS, NULL);
if (uri &&
g_strcmp0 (g_uri_get_scheme (uri), g_uri_get_scheme (source_uri)) == 0 &&
- soup_uri_get_port_with_default (uri) == soup_uri_get_port_with_default
(source_uri) &&
+ g_uri_get_port (uri) == g_uri_get_port (source_uri) &&
!strcmp (g_uri_get_host (uri), g_uri_get_host (source_uri)))
dir = g_strdup (g_uri_get_path (uri));
else
diff --git a/libsoup/hsts/soup-hsts-enforcer.c b/libsoup/hsts/soup-hsts-enforcer.c
index 5a297bca..a1e46841 100644
--- a/libsoup/hsts/soup-hsts-enforcer.c
+++ b/libsoup/hsts/soup-hsts-enforcer.c
@@ -495,7 +495,7 @@ rewrite_message_uri_to_https (SoupMessage *msg)
int port;
uri = soup_message_get_uri (msg);
- port = soup_uri_get_port_with_default (uri);
+ port = g_uri_get_port (uri);
/* From the RFC: "If the URI contains an explicit port component that
is not equal to "80", the port component value MUST be preserved;" */
if (port == 80)
diff --git a/libsoup/soup-connection.c b/libsoup/soup-connection.c
index e6a79bf7..c47e962e 100644
--- a/libsoup/soup-connection.c
+++ b/libsoup/soup-connection.c
@@ -604,7 +604,7 @@ soup_connection_connect_async (SoupConnection *conn,
priv->remote_connectable =
g_object_new (G_TYPE_NETWORK_ADDRESS,
"hostname", g_uri_get_host (priv->remote_uri),
- "port", soup_uri_get_port_with_default (priv->remote_uri),
+ "port", g_uri_get_port (priv->remote_uri),
"scheme", g_uri_get_scheme (priv->remote_uri),
NULL);
@@ -648,7 +648,7 @@ soup_connection_connect (SoupConnection *conn,
priv->remote_connectable =
g_object_new (G_TYPE_NETWORK_ADDRESS,
"hostname", g_uri_get_host (priv->remote_uri),
- "port", soup_uri_get_port_with_default (priv->remote_uri),
+ "port", g_uri_get_port (priv->remote_uri),
"scheme", g_uri_get_scheme (priv->remote_uri),
NULL);
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index 296f9d06..c2e1fa55 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -690,7 +690,7 @@ soup_session_host_new (SoupSession *session, GUri *uri)
host->addr = g_object_new (G_TYPE_NETWORK_ADDRESS,
"hostname", g_uri_get_host (host->uri),
- "port", soup_uri_get_port_with_default (host->uri),
+ "port", g_uri_get_port (host->uri),
"scheme", g_uri_get_scheme (host->uri),
NULL);
host->keep_alive_src = NULL;
diff --git a/libsoup/soup-uri-utils.c b/libsoup/soup-uri-utils.c
index fe596a0b..062ed1cc 100644
--- a/libsoup/soup-uri-utils.c
+++ b/libsoup/soup-uri-utils.c
@@ -83,25 +83,6 @@ path_equal (const char *one, const char *two)
return !strcmp (one, two);
}
-/**
- * soup_uri_get_port_with_default:
- * @uri: A #GUri
- *
- * If @uri has a port of `-1` this will return the default
- * port for the sheme it uses if known.
- *
- * Returns: The port to use with the @uri or `-1` if unknown.
- */
-int
-soup_uri_get_port_with_default (GUri *uri)
-{
- int port = g_uri_get_port (uri);
- if (port != -1)
- return port;
-
- return soup_scheme_default_port (g_uri_get_scheme (uri));
-}
-
static gboolean
flags_equal (GUriFlags flags1, GUriFlags flags2)
{
@@ -130,7 +111,7 @@ soup_uri_equal (GUri *uri1, GUri *uri2)
if (!flags_equal (g_uri_get_flags (uri1), g_uri_get_flags (uri2)) ||
g_strcmp0 (g_uri_get_scheme (uri1), g_uri_get_scheme (uri2)) ||
- soup_uri_get_port_with_default (uri1) != soup_uri_get_port_with_default (uri2) ||
+ g_uri_get_port (uri1) != g_uri_get_port (uri2) ||
!parts_equal (g_uri_get_user (uri1), g_uri_get_user (uri2), FALSE) ||
!parts_equal (g_uri_get_password (uri1), g_uri_get_password (uri2), FALSE) ||
!parts_equal (g_uri_get_host (uri1), g_uri_get_host (uri2), TRUE) ||
@@ -234,7 +215,6 @@ soup_uri_host_equal (gconstpointer v1, gconstpointer v2)
GUri *one = (GUri*)v1;
GUri *two = (GUri*)v2;
const char *one_host, *two_host;
- int one_port, two_port;
g_return_val_if_fail (one != NULL && two != NULL, one == two);
@@ -248,15 +228,7 @@ soup_uri_host_equal (gconstpointer v1, gconstpointer v2)
if (g_strcmp0 (g_uri_get_scheme (one), g_uri_get_scheme (two)) != 0)
return FALSE;
- one_port = g_uri_get_port (one);
- two_port = g_uri_get_port (two);
-
- if (one_port == -1 && g_uri_get_scheme (one))
- one_port = soup_scheme_default_port (g_uri_get_scheme (one));
- if (two_port == -1 && g_uri_get_scheme (two))
- two_port = soup_scheme_default_port (g_uri_get_scheme (two));
-
- if (one_port != two_port)
+ if (g_uri_get_port (one) != g_uri_get_port (two))
return FALSE;
return g_ascii_strcasecmp (one_host, two_host) == 0;
diff --git a/libsoup/soup-uri-utils.h b/libsoup/soup-uri-utils.h
index e4072b4c..8d1f0c9b 100644
--- a/libsoup/soup-uri-utils.h
+++ b/libsoup/soup-uri-utils.h
@@ -31,14 +31,12 @@ GBytes *soup_uri_decode_data_uri (const char *uri,
SOUP_AVAILABLE_IN_ALL
gboolean soup_uri_equal (GUri *uri1, GUri *uri2);
-SOUP_AVAILABLE_IN_ALL
-int soup_uri_get_port_with_default (GUri *uri);
-
SOUP_AVAILABLE_IN_ALL
GUri *soup_uri_copy (GUri *uri,
SoupURIComponent first_component,
...);
+
#define SOUP_HTTP_URI_FLAGS (G_URI_FLAGS_HAS_PASSWORD | G_URI_FLAGS_ENCODED_PATH | G_URI_FLAGS_ENCODED_QUERY
| G_URI_FLAGS_ENCODED_FRAGMENT | G_URI_FLAGS_SCHEME_NORMALIZE)
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]