Commit e889fb2a authored by Bastien Nocera's avatar Bastien Nocera Committed by Philip Withnall

resolver: Return early if URI is invalid
parent 99b792fa
......@@ -27,8 +27,10 @@
#include "gasyncresult.h"
#include "gcancellable.h"
#include "gtask.h"
#include "giomodule.h"
#include "giomodule-priv.h"
#include "gnetworkingprivate.h"
* SECTION:gproxyresolver
......@@ -145,6 +147,9 @@ g_proxy_resolver_lookup (GProxyResolver *resolver,
g_return_val_if_fail (G_IS_PROXY_RESOLVER (resolver), NULL);
g_return_val_if_fail (uri != NULL, NULL);
if (!_g_uri_parse_authority (uri, NULL, NULL, NULL, error))
return NULL;
iface = G_PROXY_RESOLVER_GET_IFACE (resolver);
return (* iface->lookup) (resolver, uri, cancellable, error);
......@@ -171,10 +176,19 @@ g_proxy_resolver_lookup_async (GProxyResolver *resolver,
gpointer user_data)
GProxyResolverInterface *iface;
GError *error = NULL;
g_return_if_fail (G_IS_PROXY_RESOLVER (resolver));
g_return_if_fail (uri != NULL);
if (!_g_uri_parse_authority (uri, NULL, NULL, NULL, &error))
g_task_report_error (resolver, callback, user_data,
g_steal_pointer (&error));
iface = G_PROXY_RESOLVER_GET_IFACE (resolver);
(* iface->lookup_async) (resolver, uri, cancellable, callback, user_data);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment