diff options
author | npmccallum <npmccallum@c587cffe-e639-0410-9787-d7902ae8ed56> | 2007-11-20 23:43:39 +0000 |
---|---|---|
committer | npmccallum <npmccallum@c587cffe-e639-0410-9787-d7902ae8ed56> | 2007-11-20 23:43:39 +0000 |
commit | 634dbdfa170a91d19e3a7431d92bbfa6de263161 (patch) | |
tree | b1c451d9906e976bbe65ee7ad04511c29200ec49 | |
parent | f6016aae5641ceba5eab3b48d50dd09fb6846c7b (diff) | |
download | libproxy-634dbdfa170a91d19e3a7431d92bbfa6de263161.tar.gz |
make dns WPAD a bit more robust
git-svn-id: http://libproxy.googlecode.com/svn/trunk@59 c587cffe-e639-0410-9787-d7902ae8ed56
-rw-r--r-- | src/lib/dns.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lib/dns.c b/src/lib/dns.c index ddf55a6..9fb5d44 100644 --- a/src/lib/dns.c +++ b/src/lib/dns.c @@ -96,6 +96,15 @@ get_domain_name() static pxURL ** get_urls(const char *domain) { + pxURL **urls; + + if (!domain) + { + urls = px_malloc0(sizeof(pxURL *) * 2); + urls[0] = px_url_new("http://wpad/wpad.dat"); + return urls; + } + // Split up the domain char **domainv = px_strsplit(domain, "."); if (!domainv) return NULL; @@ -106,7 +115,7 @@ get_urls(const char *domain) count++; // Allocate our URL array - pxURL **urls = px_malloc0(sizeof(pxURL *) * (count + 2)); + urls = px_malloc0(sizeof(pxURL *) * (count + 2)); // Create the URLs urls[0] = px_url_new("http://wpad/wpad.dat"); @@ -160,6 +169,8 @@ px_dns_new_full(const char *domain) pxPAC * px_dns_next(pxDNS *self) { + if (!self) return NULL; + if (!self->urls) { char *domain; @@ -171,7 +182,6 @@ px_dns_next(pxDNS *self) domain = px_strdup(self->domain); else domain = get_domain_name(); - if (!domain) return NULL; // Get the URLs self->urls = get_urls(domain); |