If SOUP_SYNC_DNS is in the user's environment, use an old fashioned
authorJoe Shaw <joe@ximian.com>
Wed, 13 Jun 2001 20:04:51 +0000 (20:04 +0000)
committerJoe Shaw <joeshaw@src.gnome.org>
Wed, 13 Jun 2001 20:04:51 +0000 (20:04 +0000)
2001-06-13  Joe Shaw  <joe@ximian.com>

* src/soup-core/soup-socket.c (soup_address_new): If SOUP_SYNC_DNS is
in the user's environment, use an old fashioned synchronous DNS lookup
on UNIX.

ChangeLog
libsoup/soup-socket.c

index 900e2ab..581d763 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2001-06-13  Joe Shaw  <joe@ximian.com>
+
+       * src/soup-core/soup-socket.c (soup_address_new): If SOUP_SYNC_DNS is
+       in the user's environment, use an old fashioned synchronous DNS lookup
+       on UNIX.
+
 2001-06-07  Joe Shaw  <joe@ximian.com>
 
        * src/soup-core/soup-message.c (soup_message_redirect): Change
index 1ed508e..f37a620 100644 (file)
@@ -688,6 +688,28 @@ soup_address_new (const gchar* name,
                }
        }
 
+       /* Check to see if we are doing synchronous DNS lookups */
+       if (getenv("SOUP_SYNC_DNS")) {
+               if (!soup_gethostbyname(name, &sa, NULL)) {
+                       g_warning("Problem resolving host name");
+                       (*func) (NULL, SOUP_ADDRESS_STATUS_ERROR, data);
+                       return NULL;
+               }
+               
+               sa_in = (struct sockaddr_in*) &sa;
+               sa_in->sin_family = AF_INET;
+               sa_in->sin_port = g_htons (port);
+               
+               ia = g_new0(SoupAddress, 1);
+               ia->name = g_strdup(name);
+               ia->ref_count = 1;
+               ia->sa = *((struct sockaddr *) &sa);
+               
+               (*func)(ia, SOUP_ADDRESS_STATUS_OK, data);
+               
+               return NULL;
+       }
+
        /* That didn't work - we need to fork */
 
        /* Open a pipe */