Subj : Re: Still unsolved problem To : netscape.public.mozilla.jseng From : "Stu" Date : Thu Jun 05 2003 11:57 am > What is proxy_dns_resolve? Heres the Code /* Resolves a DNS name, and returns the IP address string. * * Maintains a private cache for the last resolved address (so this * function can be called multiple times with the same host argument * without doing actual DNS queries every time). */ static char *proxy_dns_resolve(const char *host) { //static char *cache_host = NULL; //static char *cache_ip = NULL; static char cache_host[512] = {'\0'}; static char cache_ip[512] = {'\0'}; static int m_finished; /* finished flag */ int result; int status; host_info_t info; if (host) { const char *p; char *safe = NULL; int is_numeric_ip = 1; for(p=host; *p; p++) { if (!isdigit(*p) && *p != '.') { is_numeric_ip = 0; break; } } if (is_numeric_ip) { return strdup(host); } if ( (strlen(cache_host) >0) && (strlen(cache_ip) >0) && !strcmp(cache_host, host)) { return strdup(cache_ip); } safe = strdup(host); if (safe) { if (strlen(safe) > 64) safe[64] = '\0'; /* clear finished flag */ m_finished = 0; CMxLookup m_MxLookUp; m_MxLookUp.add_server(DEFAULT_DNS); result = m_MxLookUp.start_ip_lookup(safe); if (result < 0) { printf("DNS lookup failed to start. Result(%s).\n",m_MxLookUp.error_string(result)); return(NULL); } /* loop until finished */ do { /* get the status of the lookup */ status = m_MxLookUp.get_status(&info); /* check results */ if (status == BTOMX_LOOKUP_STILL_ACTIVE) { } else if (status == BTOMX_LOOKUP_DONE_AND_FOUND) { /* read out the complete list of servers */ while (info.valid) { printf("%-16s : %s : %s\n",info.ipaddr_str,info.canonical_name, info.orig_request_name); status = m_MxLookUp.get_status(&info); } m_finished = 1; } else { printf("DNS lookup completed. Result(%s).\n",m_MxLookUp.error_string(status)); m_finished = 1; } /* sleep for a bit */ Sleep(100); /* call the timer event */ m_MxLookUp.timer_event(); } while (m_finished == 0); free(safe); } if (info.ipaddr) { char* cache_host_ptr =NULL; char* cache_ip_ptr = NULL; StrAllocCopy(&cache_host_ptr, host); StrAllocCopy(&cache_ip_ptr, info.ipaddr_str); strcpy(cache_host, cache_host_ptr); strcpy(cache_ip, cache_ip_ptr); return strdup(info.ipaddr_str); } } return NULL; } > When you say error, is this a JS exception? How is it getting reported? I think its just an error, would the message say exception if it was one? Its getting written to the screen by my ErrorReporter function. > Also I see proxy_dnsResolve and proxy_dns_resove, I assume the latter is the implementation called by both proxy_isInNet and proxy_dnsResolve? If that's the case you might want to simplify your test and trying to just invoke the dnsResolve and see what happens. No proxy_dnsResolve is at the bottom layer proxy function, i've included that code above. > I'd start by seeing what the value of host is in FindProxyForURL then check ipstr and ip in proxy_isInNet. You could dump this to a file fairly easily if you don't want to go to the trouble of building a release with symbols. (It's not that hard, though) I do the following: > im printf to screen with a sleep statement / a breakpoint. And the ipstr and ip are not being written as the ReferenceError occurs before during the function call. CallFunctionName then return false and my prog drops out. Can u confirm that I should be able to use the release JS32.dll with a debug build of my C++ project, cos that what i've been doing. Thanks for the responses, Stu. .