if(!URL_s) return NULL;  orig_url=URL_s->address; method=mkMethodString(URL_s->method);
MODULE_PRIVATE char *pacf_find_proxies_for_url(MWContext *context, 											   URL_Struct *URL_s ) {#ifdef MOCHA    jsval rv;    char *buf = NULL;    char *host = NULL;    char *p, *q, *r;    int i, len = 0;    char *safe_url = NULL;    char *orig_url = URL_s->address;    char *method = mkMethodString(URL_s->method);    char *bad_url = NULL;    char *result = NULL;    JSBool ok;    /* If proxy failover is not allowed, and we weren't     * able to autoload the proxy, return a string that     * pacf_get_proxy_addr will always fail with. */    if ( !pacf_do_failover && !pacf_loading && !pacf_ok ) {      return "";    }    if (!orig_url || !pacf_ok || pacf_loading || pacf_find_proxy_undefined)	return NULL;    if (!(bad_url = XP_STRDUP(orig_url)))	goto out;    len = NET_UnEscapeCnt(bad_url);    if (!(safe_url = XP_ALLOC(2 * len + 1)))    /* worst case */	goto out;    p = bad_url;    q = safe_url;    for(i=0; i<len; i++, p++) {	switch (*p) {	  case '\n':	    *q++ = '\\';	    *q++ = 'n';	    break;	  case '\r':	    *q++ = '\\';	    *q++ = 'r';	    break;	  case '\0':	    *q++ = '\\';	    *q++ = '0';	    break;	  case '"':	    *q++ = '\\';	    *q++ = '"';	    break;	  case '\\':	    *q++ = '\\';	    *q++ = '\\';	    break;	  default:	    *q++ = *p;	}    }    *q = '\0';    len  = (int)(q - safe_url);    if (!(host = XP_ALLOC(len + 1)))	goto out;    if (!(buf  = XP_ALLOC(len*2 + 50)))	goto out;    host[0] = '\0';    p = XP_STRSTR(safe_url, "://");    if (p) {	p += 3;	q = XP_STRCHR(p, '/');	if (q)	    *q = '\0';	r = XP_STRCHR(p, '@');	if (r)		p = r + 1;	XP_STRCPY(host, p);	if (q)	    *q = '/';	p = XP_STRCHR(host, ':');	if (p)	    *p = '\0';    }	    XP_SPRINTF(buf, "FindProxyForURL(\"%s\",\"%s\",\"%s\")", safe_url, host,	       method ? method : "" );    if (!JS_AddRoot(configContext, &rv))	goto out;		ok = JS_EvaluateScript(configContext, proxyConfig,			   buf, strlen(buf), 0, 0, &rv);    if (ok) {	if (JSVAL_IS_STRING(rv)) {	    const char *name =		JS_GetStringBytes(JSVAL_TO_STRING(rv));	    if (*name)		result = XP_STRDUP(name);	}    }    JS_RemoveRoot(configContext, &rv);out:    FREEIF(method);    FREEIF(buf);    FREEIF(host);    FREEIF(safe_url);    FREEIF(bad_url);    return result;#else   /* ! MOCHA */    return NULL;#endif  /* ! MOCHA */}