This fixes a logical bug in gweb, as for a given host: if a proxy
address is provided it should resolv its DNS through g_resolv and not
getaddrinfo: g_resolv will then use the nameservers that have been set
to the g_web session.

Indirectly, this fixes a bug when ConnMan was always staying at ready
when service was proxied, even though such proxy would allow to go on
internet.
---
 gweb/gweb.c | 26 +++-----------------------
 1 file changed, 3 insertions(+), 23 deletions(-)

diff --git a/gweb/gweb.c b/gweb/gweb.c
index 3d9645a..81dbff0 100644
--- a/gweb/gweb.c
+++ b/gweb/gweb.c
@@ -1308,32 +1308,12 @@ static guint do_request(GWeb *web, const char *url,
                        return 0;
                }
        } else {
-               struct addrinfo hints;
-               char *port;
-               int ret;
-
                if (!session->address)
                        session->address = g_strdup(session->host);
 
-               memset(&hints, 0, sizeof(struct addrinfo));
-               hints.ai_flags = AI_NUMERICHOST;
-               hints.ai_family = session->web->family;
-
-               if (session->addr) {
-                       freeaddrinfo(session->addr);
-                       session->addr = NULL;
-               }
-
-               port = g_strdup_printf("%u", session->port);
-               ret = getaddrinfo(session->address, port, &hints,
-                                                       &session->addr);
-               g_free(port);
-               if (ret != 0 || !session->addr) {
-                       free_session(session);
-                       return 0;
-               }
-
-               if (create_transport(session) < 0) {
+               session->resolv_action = g_resolv_lookup_hostname(web->resolv,
+                                       session->address, resolv_result, 
session);
+               if (session->resolv_action == 0) {
                        free_session(session);
                        return 0;
                }
-- 
1.8.3.2

_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to