&& (this_entry->proxy_conf = pacf_find_proxies_for_url(window_id, URL_s)) != NULL && (pacf_status = pacf_get_proxy_addr(window_id,
&& ((this_entry->proxy_conf = pacf_find_proxies_for_url(window_id, URL_s)) != NULL) && ((pacf_status = pacf_get_proxy_addr(window_id,
NET_GetURL (URL_Struct *URL_s,	    FO_Present_Types output_format,	    MWContext *window_id,	    Net_GetUrlExitFunc* exit_routine){    int          status=MK_MALFORMED_URL_ERROR;    int          pacf_status=TRUE;    int          type;    int          cache_method=0;    ActiveEntry *this_entry=0;  /* a new entry */	char        *new_address;	int processcallbacks = 0;	Bool confirm;	Bool load_background;	char *confirmstring;	TRACEMSG(("Entering NET_GetURL"));	LIBNET_LOCK();#if !defined(NSPR20_DISABLED) && defined(XP_UNIX)	/* temporarily use busy poll to ease transition */	NET_SetCallNetlibAllTheTime(window_id, "mkgeturl");#endif	#ifdef XP_WIN	/* this runs a timer to periodically call the netlib	 * so that we still get events even when OnIdle is never	 * called	 */	NET_SetNetlibSlowKickTimer(TRUE);#endif	PR_ASSERT (URL_s && URL_s->address);#ifdef MOZILLA_CLIENT	if ( URL_s->mailto_post && warn_on_mailto_post) {		confirmstring = NULL;		confirm = FALSE;				StrAllocCopy(confirmstring, XP_GetString(XP_CONFIRM_MAILTO_POST_1));		StrAllocCat(confirmstring, XP_GetString(XP_CONFIRM_MAILTO_POST_2));				if ( confirmstring ) {			confirm = FE_Confirm(window_id, confirmstring);			PR_Free(confirmstring);		}				if ( !confirm ) {			/* abort url			 */			net_CallExitRoutine(exit_routine,								URL_s,								MK_INTERRUPTED,								output_format,								window_id);			LIBNET_UNLOCK_AND_RETURN(MK_INTERRUPTED);		}	}#endif /* MOZILLA_CLIENT */     #ifdef EDITOR    /* First time here - get our strings out of XP_MSG */    if (XP_NEW_DOC_URL == NULL) {		StrAllocCopy(XP_NEW_DOC_URL, XP_GetString(XP_EDIT_NEW_DOC_URL));    }    if (XP_NEW_DOC_NAME == NULL) {		StrAllocCopy(XP_NEW_DOC_NAME, XP_GetString(XP_EDIT_NEW_DOC_NAME));    }    /* Test for "Untitled" URL */    if( 0 == PL_strcmp(URL_s->address, XP_NEW_DOC_NAME) ) {    	/* Change request to load "file:///Untitled" into "about:editfilenew"  */	    PR_Free(URL_s->address);	    URL_s->address = PL_strdup(XP_NEW_DOC_URL);	    /* Set flag so FE can quickly detect new doc */	    window_id->is_new_document = TRUE;    }    else if( 0 == PL_strcmp(URL_s->address, XP_NEW_DOC_URL) ) {		window_id->is_new_document = TRUE;    }    else {        /* Be sure this is FALSE if not a new document */        window_id->is_new_document = FALSE;    }    /* Hack to allow special URL for new Editor doc      *   and still allow filtering of non-editable doc types     * All editor GetUrl calls should use FO_CACHE_AND_EDIT     *   except in the case of the new document URL    */    if( EDT_IS_EDITOR(window_id) && window_id->is_new_document ) {        output_format = FO_CACHE_AND_PRESENT;    }#endif#ifdef MOZILLA_CLIENT		/* Hack. Proxy AutoDiscovery. If we want to use proxy autodiscovery	     * simply point the MKproxy_ac_url to the MK_padpacURL and use all 	     * all the same logic. */		if(!MKproxy_ac_url && NET_UsingPadPac()) {			NET_SetNoProxyFailover();			MKproxy_ac_url=MK_padPacURL;		}	/* Initialize global/auto proxy codepath. This gets called for every 	 * NET_GetURL() call. */	if (#ifdef MOZ_OFFLINE		!NET_IsOffline() &&#endif /* MOZ_OFFLINE */		/* Do we even have auto config urls set? If not, don't bother		 * continuing. See mkautocf.c for more info. */		(MKglobal_config_url || MKproxy_ac_url)		&& (CLEAR_CACHE_BIT(output_format) == FO_PRESENT)		&& (!(type = NET_URL_Type(URL_s->address))		 || type == HTTP_TYPE_URL		 || type == SECURE_HTTP_TYPE_URL		 || type == GOPHER_TYPE_URL		 || type == FTP_TYPE_URL		 || type == WAIS_TYPE_URL		 || type == URN_TYPE_URL		 || type == NFS_TYPE_URL		 || type == POP3_TYPE_URL		 || (type == NEWS_TYPE_URL && !PL_strncasecmp(URL_s->address, "snews:", 6)))		 ) {		int status=-1;		/* Figure out which auto config we're dealing (global or pac file		 * with and load it.		 * If the status is other than -1, the load started and the 		 * originally requested url will be loaded by the pre_exit_fn()		 * that is in the proxy auto config URL_Struct. */		if(MKglobal_config_url && !NET_GlobalAcLoaded) {			NET_GlobalAcLoaded=TRUE;			status=NET_LoadProxyConfig(MKglobal_config_url,										URL_s,										output_format,										window_id,										exit_routine);		} 		/* else we know we're dealing with a proxyACL (the other 		 * possibility in the above if statement) so see if it's 		 * loaded or not. Also make sure we want to use it (i.e. style is		 * automatic or if we want to use a proxy autodiscovery url). */		else if(!NET_ProxyAcLoaded				&& (   (MKproxy_style == PROXY_STYLE_AUTOMATIC) 					|| !MKproxy_style					|| NET_UsingPadPac() ) ) {			NET_ProxyAcLoaded=TRUE;			status=NET_LoadProxyConfig(MKproxy_ac_url,										URL_s,										output_format,										window_id,										exit_routine);		}		if(status != -1)			LIBNET_UNLOCK_AND_RETURN(status);	} /* End big proxy if */#endif  /* MOZILLA_CLIENT */	load_background = URL_s->load_background;	/* kill leading and trailing spaces in the URL address	 */	new_address = XP_StripLine(URL_s->address);	if(new_address != URL_s->address)	  {		memmove(URL_s->address, new_address, PL_strlen(new_address)+1);	  }	/* get the protocol type	 */    type = NET_URL_Type(URL_s->address);	if (URL_s->method == URL_HEAD_METHOD &&		type != HTTP_TYPE_URL && type != SECURE_HTTP_TYPE_URL && type != FILE_TYPE_URL) {	  /* We can only do HEAD on http connections. */	  net_CallExitRoutine(exit_routine,						  URL_s,						  MK_MALFORMED_URL_ERROR, /* Is this right? ### */						  output_format,						  window_id);	  /* increment since it will get decremented */	  NET_TotalNumberOfProcessingURLs++;	  net_CheckForWaitingURL(window_id, 0, load_background);	  LIBNET_UNLOCK_AND_RETURN(MK_MALFORMED_URL_ERROR);	}    /* XP_OS2_FIX IBM-MAS:limit length of output to keep from blowing trace buffer! */   TRACEMSG(("Called NET_GetURL with FO: %d URL %-.1900s --", output_format, URL_s->address));   TRACEMSG(("with method: %d, and post headers: %s", URL_s->method,            URL_s->post_headers ? URL_s->post_headers : "none"));	/* if this URL is for prefetching, put it on the wait queue until	 * everything else is done	 */	if(URL_s->priority == Prefetch_priority)	{		LIBNET_UNLOCK_AND_RETURN(net_push_url_on_wait_queue(type,															URL_s,															output_format,															window_id,															exit_routine));	}	/* put a limit on the total number of active urls	 */    if((NET_TotalNumberOfProcessingURLs >= MAX_NUMBER_OF_PROCESSING_URLS) &&        ((output_format & FO_ONLY_FROM_CACHE) == 0))	  {	LIBNET_UNLOCK_AND_RETURN(net_push_url_on_wait_queue(type,															URL_s,															output_format,															window_id,															exit_routine));	  }	/* if we get this far then we should add the URL	 * to the number of processing URL's	 */	NET_TotalNumberOfProcessingURLs++;	if(type == VIEW_SOURCE_TYPE_URL)	  {		/* this is a view-source: URL		 * strip off the front stuff 		 */		char *new_address=0;		/* the colon is guarenteed to be there */		StrAllocCopy(new_address, PL_strchr(URL_s->address, ':')+1);		FREE(URL_s->address);		URL_s->address = new_address;		type = NET_URL_Type(URL_s->address);		/* remap the format out for the fo_present type		 */		if(CLEAR_CACHE_BIT(output_format) == FO_PRESENT)			output_format = FO_VIEW_SOURCE;	  }	if(type == MARIMBA_TYPE_URL)	  {		/* If this a castanet URL, and Netcaster is not installed, try http://		 * Otherwise, we let the castanet protocol handler do its thing.		 */		if( ! FE_IsNetcasterInstalled() )		{			char *new_address;			/* Replace castanet:// with http:// */			/* Allocate space for 'http' + the rest of the string */			new_address = PR_Malloc(PL_strlen(PL_strchr(URL_s->address, ':'))+5);			PR_ASSERT(new_address);			*new_address=0;			PL_strcat(new_address,"http");			PL_strcat(new_address,PL_strchr(URL_s->address, ':'));			FREE(URL_s->address);			URL_s->address = new_address;			type = NET_URL_Type(URL_s->address);		}	  }	if(type == NETHELP_TYPE_URL)	  {		/* this is a nethelp: URL		 * separate into its component parts, the mapping file in URL_s->address,		 * and the topic in URL_s->fe_data		 */		if (NET_ParseNetHelpURL(URL_s) == MK_OUT_OF_MEMORY) {			LIBNET_UNLOCK_AND_RETURN(MK_OUT_OF_MEMORY);		}				type = NET_URL_Type(URL_s->address);		output_format = FO_LOAD_HTML_HELP_MAP_FILE;	  }#ifdef MOZILLA_CLIENT	if(#if defined(XP_WIN) || defined(XP_MAC) || defined(XP_OS2)	   FE_UseExternalProtocolModule(window_id, output_format, URL_s, exit_routine) ||#endif	   NPL_HandleURL(window_id, output_format, URL_s, exit_routine))      {		/* don't call the exit routine since the		 * External protocol module will call it		 */	net_CheckForWaitingURL(window_id, 0, load_background); 	LIBNET_UNLOCK_AND_RETURN(-1); /* all done */      }	if(NET_TimeBombActive)	  {		/* Timebomb has gone off!!		 *		 * limit URL's to FTP and anything in our domains		 */		if(type != FTP_TYPE_URL			&& type != ABOUT_TYPE_URL			 && type != FILE_TYPE_URL			  && type != MAILBOX_TYPE_URL			   && type != IMAP_TYPE_URL			   && type != POP3_TYPE_URL			    && type != MOCHA_TYPE_URL			     && type != DATA_TYPE_URL			  && type != HTML_DIALOG_HANDLER_TYPE_URL				   && type != HTML_PANEL_HANDLER_TYPE_URL					&& type != INTERNAL_SECLIB_TYPE_URL			  && !PL_strcasestr(URL_s->address, "mcom.com")			       &&  !PL_strcasestr(URL_s->address, "netscape.com"))		  {			char * alert = NET_ExplainErrorDetails(MK_TIMEBOMB_URL_PROHIBIT);			FE_Alert(window_id, alert);			FREE(alert);		/* we need at least an address		 * if we don't have it exit this routine	     */		net_CallExitRoutine(exit_routine,			    URL_s,			    MK_TIMEBOMB_URL_PROHIBIT,							output_format,			    window_id);			net_CheckForWaitingURL(window_id, 0, load_background);		LIBNET_UNLOCK_AND_RETURN(MK_TIMEBOMB_URL_PROHIBIT);		  }	  }	/* put up security dialog boxes to tell the user	 * about transitions	 *	 * only do this for FO_PRESENT objects and objects	 * not coming out of history	 * and also make sure that the object is not being asked	 * for twice via the "304 use local copy" method	 */	if(output_format == FO_CACHE_AND_PRESENT		&& !URL_s->history_num		 && !URL_s->use_local_copy)	  {		Bool continue_loading_url = TRUE;		History_entry * h = SHIST_GetCurrent(&window_id->hist);		/* this is some protection against the "mail document"		 * feature popping up a dialog warning about an insecure		 * post.		 * If the type is MAILTO and the first post header		 * begins with "Content-type" then it is a post from		 * inside a form, otherwise it is just a normal MAILTO		 *		 * And, of course, anything not a MAILTO link will fall		 * into the if as well.		 */		if(type != MAILTO_TYPE_URL			|| !URL_s->post_headers			 || !PL_strncmp("Content-type", URL_s->post_headers, 12))		  {		    if(h && h->security_on)		      {				/* if this is not a secure transaction */			    if(type != SECURE_HTTP_TYPE_URL					&& !(type == NEWS_TYPE_URL &&						 toupper(*URL_s->address) == 'S') )			      {				    if(URL_s->method == URL_POST_METHOD)				      {					    continue_loading_url = (Bool)SECNAV_SecurityDialog(window_id,										   SD_INSECURE_POST_FROM_SECURE_DOC);				      }				    else if(!URL_s->redirecting_url							 && type != MAILTO_TYPE_URL								&& type != ABOUT_TYPE_URL							       && type != MOCHA_TYPE_URL)				      {					    /* don't put up in case of redirect or mocha					     */					    continue_loading_url = (Bool)SECNAV_SecurityDialog(window_id,										   SD_LEAVING_SECURE_SPACE);				      }			      }		      }		    else		      {				/* put up a dialog for all insecure posts				 * except news and mail posts				 */			    if(URL_s->method == URL_POST_METHOD					&& type != SECURE_HTTP_TYPE_URL					 && type != INTERNAL_NEWS_TYPE_URL					 && type != NEWS_TYPE_URL					  && type != HTML_DIALOG_HANDLER_TYPE_URL					   && type != HTML_PANEL_HANDLER_TYPE_URL					   && type != INTERNAL_SECLIB_TYPE_URL					    && type != MAILTO_TYPE_URL)		  {				    continue_loading_url = (Bool)SECNAV_SecurityDialog(window_id,					   SD_INSECURE_POST_FROM_INSECURE_DOC);		  }		      }		    if(!continue_loading_url)		      {			    /* abort url		 */		net_CallExitRoutine(exit_routine,									URL_s,									MK_INTERRUPTED,									output_format,									window_id);		net_CheckForWaitingURL(window_id, 0, load_background);		LIBNET_UNLOCK_AND_RETURN(MK_INTERRUPTED);		      }		  }      }#endif /* MOZILLA_CLIENT */	/*	 * if the string is not a valid URL we are just going     * to punt, so we may as well try it as http	 */	if(type==0)	{		char *munged;#define INT_SEARCH_URL "http://cgi.netscape.com/cgi-bin/url_search.cgi?search="#define INT_SEARCH_URL_TYPE HTTP_TYPE_URL		if(!(munged = (char*) PR_Malloc(PL_strlen(URL_s->address)+20)))		{		    net_CallExitRoutine(exit_routine,								URL_s,								MK_OUT_OF_MEMORY,								output_format,								window_id);						LIBNET_UNLOCK_AND_RETURN(MK_OUT_OF_MEMORY);		}       #ifdef EDITOR	/* Some platforms resize a window while creating it. An example is	 * Windows in Communicator 4.0. On these platforms,	 * the Composer View Document Source window can end up here with a	 * bizarre (and potentially localized) URL of "View Document Source".	 * If we allow this URL to be resolved, it will cause a search engine	 * to be triggered.	 * Fortunately, edit_view_source_hack is TRUE iff the context is	 * a Composer View Document Source window.	 */	if ( window_id->edit_view_source_hack ){	    net_CallExitRoutine(exit_routine,							    URL_s,							    MK_INTERRUPTED,							    output_format,							    window_id);			LIBNET_UNLOCK_AND_RETURN(MK_INTERRUPTED);	}#endif		/* if it starts with a question mark or has a space it's		 * a search URL		 */		if(*URL_s->address == '?' || PL_strchr(URL_s->address, ' '))		  {			/* URL contains spaces.  Treat it as search text. */			char *escaped;			if(*URL_s->address == '?')				escaped = NET_Escape(URL_s->address+1, URL_XPALPHAS);			else				escaped = NET_Escape(URL_s->address, URL_XPALPHAS);			if(escaped)			  {				char *pUrl;				PREF_CopyCharPref("network.search.url",&pUrl);				FREE(munged);				if (pUrl) {					munged = PR_smprintf("%s%s", pUrl, escaped);					FREE(escaped);					PR_Free(pUrl);				}			    type = INT_SEARCH_URL_TYPE;			  }		  }		else		  {			if(*URL_s->address == '/')			  {			    PL_strcpy(munged, "file:");			    type = FILE_TYPE_URL;		      }		    else if(!PL_strncasecmp(URL_s->address, "ftp", 3))		      {			    PL_strcpy(munged, "ftp://");			    type = FTP_TYPE_URL;		      }		    else if(!PL_strncasecmp(URL_s->address, "gopher", 6))		      {			    PL_strcpy(munged, "gopher://");			    type = GOPHER_TYPE_URL;		      }		    else if(!PL_strncasecmp(URL_s->address, "news", 4)				    || !PL_strncasecmp(URL_s->address, "nntp", 4))		      {			    PL_strcpy(munged, "news://");			    type = NEWS_TYPE_URL;		      }			else		      {			    PL_strcpy(munged, "http://");			    type = HTTP_TYPE_URL;		      }    		    PL_strcat(munged, URL_s->address);		  }		PR_Free(URL_s->address);		URL_s->address = munged;#ifdef MOZILLA_CLIENT		/*      Try the external protocol handlers again, since with the		 *              newly appended protocol, they might work this time.		 */		if(	#if defined(XP_WIN) || defined(XP_MAC)		   FE_UseExternalProtocolModule(window_id, output_format, URL_s, exit_routine) ||	#endif		   NPL_HandleURL(window_id, output_format, URL_s, exit_routine))	      {			/* don't call the exit routine since the			 * External protocol module will call it			 */		net_CheckForWaitingURL(window_id, 0, load_background); 		LIBNET_UNLOCK_AND_RETURN(-1); /* all done */	      }#endif /* MOZILLA_CLIENT */	}    if(type == HTTP_TYPE_URL || type == FILE_TYPE_URL ||		type == SECURE_HTTP_TYPE_URL || type == GOPHER_TYPE_URL#ifdef JAVA	/* Castanet URLs don't work when there's no Java */		|| type == MARIMBA_TYPE_URL#endif		)	add_slash_to_URL(URL_s);#ifdef MOZILLA_CLIENT	/*	 * If this is a resize-reload OR a view-source URL, try to use the	 * URL's wysiwyg: counterpart.	 */	URL_s->resize_reload = (URL_s->force_reload == NET_RESIZE_RELOAD);	if(URL_s->wysiwyg_url &&	   (URL_s->resize_reload == TRUE ||		CLEAR_CACHE_BIT(output_format) == FO_VIEW_SOURCE))	  {		StrAllocCopy(URL_s->address, URL_s->wysiwyg_url);		type = WYSIWYG_TYPE_URL;	  }	/* the FE's were screwing up the use of force_reload     * to get around a bug in the scroll to named anchor	 * code.  So I gave them an enum NET_RESIZE_RELOAD	 * that they could use instead.  NET_RESIZE_RELOAD	 * should be treated just like NET_DONT_RELOAD within	 * the netlib	 */	if((URL_s->force_reload == NET_RESIZE_RELOAD) ||       (URL_s->force_reload == NET_CACHE_ONLY_RELOAD))		URL_s->force_reload = NET_DONT_RELOAD;    /* check for the url in the cache     */    cache_method = NET_FindURLInCache(URL_s, window_id);	if (!cache_method)	  {		/* cache testing stuff */		if(NET_IsCacheTraceOn())		  {			char *buf = 0;			StrAllocCopy(buf, XP_GetString(XP_URL_NOT_FOUND_IN_CACHE));			StrAllocCat(buf, URL_s->address);			FE_Alert(window_id, buf);			FREE(buf);		  }		/* if wysiwyg, there must be a cache entry or we retry the real url */		if(type == WYSIWYG_TYPE_URL)		  {			const char *real_url = LM_SkipWysiwygURLPrefix(URL_s->address);			/* XXX can't use StrAllocCopy because it frees dest first */			if (real_url && (new_address = PL_strdup(real_url)) != NULL)			  {				/* cache miss: we must clear this flag so scripts rerun */				URL_s->resize_reload = FALSE;				PR_Free(URL_s->address);				URL_s->address = new_address;				FREE_AND_CLEAR(URL_s->wysiwyg_url);				/* 		 		* Since the call to NET_GetURL will increment the		 		* following counter again, we decrement it so as not		 		* to overcount.		 		*/				NET_TotalNumberOfProcessingURLs--;				LIBNET_UNLOCK_AND_RETURN(							NET_GetURL(URL_s, output_format, window_id, exit_routine)						);			  }		  }	  }    /* if cache_method is non zero then we have this URL cached.  Use     * the bogus cache url type	 *	 * This nasty bit of logic figures out if we really	 * need to reload it or if we can use the cached copy     */    else      {		if(URL_s->use_local_copy || output_format & FO_ONLY_FROM_CACHE)		  {	    /* the cached file is valid so use it unilaterally	     */	    type = cache_method;		  }		else if(URL_s->real_content_length > URL_s->content_length)		  {			/* cache testing stuff */			if(NET_IsCacheTraceOn())			  {				char *buf = 0;				StrAllocCopy(buf, XP_GetString(XP_PARTIAL_CACHE_ENTRY));				StrAllocCat(buf, URL_s->address);				FE_Alert(window_id, buf);				FREE(buf);			  }	    URL_s->memory_copy = 0;	    cache_method = 0;	    TRACEMSG(("Getting the rest of a partial cache file"));		  }	else if (URL_s->force_reload != NET_DONT_RELOAD)	  {	    TRACEMSG(("Force reload flag set.  Checking server to see if modified"));	    /* cache testing stuff */	    if(NET_IsCacheTraceOn())	      {		char *buf = 0;		StrAllocCopy(buf, XP_GetString(XP_CHECKING_SERVER__FORCE_RELOAD));		StrAllocCat(buf, URL_s->address);		FE_Alert(window_id, buf);		FREE(buf);	      }	    /* strip the cache file and	     * memory pointer	     */	    if (type == WYSIWYG_TYPE_URL)		type = cache_method;	    else	      {		FREE_AND_CLEAR(URL_s->cache_file);		URL_s->memory_copy = 0;		cache_method = 0;	      }	  }	else if(URL_s->expires)         	  {	    time_t cur_time = time(NULL);	    if(cur_time > URL_s->expires)	      {		FREE_AND_CLEAR(URL_s->cache_file);		URL_s->memory_copy = 0;		URL_s->expires = 0;  /* remove cache reference */		cache_method = 0;		/* cache testing stuff */		if(NET_IsCacheTraceOn())		  {		    char *buf = 0;		    StrAllocCopy(buf, XP_GetString(XP_OBJECT_HAS_EXPIRED));		    StrAllocCat(buf, URL_s->address);		    FE_Alert(window_id, buf);		    FREE(buf);		  }	      }			else			  {			/* the cached file is valid so use it unilaterally			 */		type = cache_method;			  }		  }		else if((NET_CacheUseMethod == CU_NEVER_CHECK || URL_s->history_num)				  && !URL_s->expires)		  {	    type = cache_method;		  }		else if(NET_CacheUseMethod == CU_CHECK_ALL_THE_TIME			    && CLEAR_CACHE_BIT(output_format) == FO_PRESENT				  && (type == HTTP_TYPE_URL || type == SECURE_HTTP_TYPE_URL)					  && !URL_s->expires)		  {			/* cache testing stuff */			if(NET_IsCacheTraceOn())			  {				char *buf = 0;				StrAllocCopy(buf, XP_GetString(XP_CHECKING_SERVER_CACHE_ENTRY));				StrAllocCat(buf, URL_s->address);				FE_Alert(window_id, buf);				FREE(buf);			  }			 /* if it's an HTTP URL and its not an Internal image			  * and it's not being asked for with ONLY FROM CACHE			  * and it's not coming out of the history			  * and it doesn't have an expiration date...			  * FORCE Reload it			  */	    TRACEMSG(("Non history http file found. Force reloading it "));	    /* strip the cache file and	     * memory pointer	     */	    FREE_AND_CLEAR(URL_s->cache_file);	    URL_s->memory_copy = 0;	    cache_method = 0;		  }		else if(!URL_s->last_modified				&& CLEAR_CACHE_BIT(output_format) == FO_PRESENT				&& (type == HTTP_TYPE_URL || type == SECURE_HTTP_TYPE_URL) #ifdef MOZ_OFFLINE            	    && !NET_IsOffline() #endif /* MOZ_OFFLINE */	    )  /* *X* check for is offline */		  {			TRACEMSG(("Non history cgi script found (probably)."					  " Force reloading it "));			/* cache testing stuff */			if(NET_IsCacheTraceOn())			  {				char *buf = 0;				StrAllocCopy(buf, XP_GetString(XP_CHECKING_SERVER__LASTMOD_MISS));				StrAllocCat(buf, URL_s->address);				FE_Alert(window_id, buf);				FREE(buf);			  }	    /* strip the cache file and	     * memory pointer	     */	    FREE_AND_CLEAR(URL_s->cache_file);	    URL_s->memory_copy = 0;		URL_s->expires = 0;  /* remove cache reference */	    cache_method = 0;		  }		else		  {		    /* the cached file is valid so use it unilaterally		     */	    type = cache_method;		  }      }#endif /* MOZILLA_CLIENT */	/*	 * If the object should only come out of the cache	 * we should abort now if there is not a cache object	 */    if(output_format & FO_ONLY_FROM_CACHE)      {		TRACEMSG(("object called with ONLY_FROM_CACHE format out"));		if(!cache_method)		  {			net_CallExitRoutine(exit_routine,								URL_s,								MK_OBJECT_NOT_IN_CACHE,								output_format,								window_id);			net_CheckForWaitingURL(window_id, type, load_background);			LIBNET_UNLOCK_AND_RETURN(MK_OBJECT_NOT_IN_CACHE);		  }		else		  {			/* remove the ONLY_FROM_CACHE designation and replace			 * it with CACHE_AND.. so that we go through the cacheing			 * module again so that we can memory cache disk objects			 * and do the right thing in general			 */			output_format = CLEAR_PRESENT_BIT(output_format,FO_ONLY_FROM_CACHE);			output_format = SET_PRESENT_BIT(output_format,FO_CACHE_ONLY);		  }      }    /* put a limit on the total number of open connections     */	if(!net_is_one_url_allowed_to_run(window_id, type))	  {		NET_TotalNumberOfProcessingURLs--; /* waiting not processing */		LIBNET_UNLOCK_AND_RETURN(net_push_url_on_wait_queue(type,															URL_s,															output_format,															window_id,															exit_routine));	  }    /* start a new entry */    this_entry = PR_NEW(ActiveEntry);    if(!this_entry)	  {	net_CallExitRoutine(exit_routine,							URL_s,							MK_OUT_OF_MEMORY,							output_format,							window_id);		LIBNET_UNLOCK_AND_RETURN(MK_OUT_OF_MEMORY);	  }    /* init new entry */    memset(this_entry, 0, sizeof(ActiveEntry));    this_entry->URL_s        = URL_s;    this_entry->socket       = NULL;    this_entry->con_sock     = NULL;    this_entry->exit_routine = exit_routine;    this_entry->window_id    = window_id;	this_entry->protocol     = type;    /* set the format out for the entry     */    this_entry->format_out = output_format;	/* set it busy */	this_entry->busy = TRUE;	/* add it to the processing list now	 */    XP_ListAddObjectToEnd(net_EntryList, this_entry);	/* this will protect against multiple posts unknown to the	 * user	 *	 * check if the method is post and it came from the	 * history and it isn't coming from the cache	 */	if(URL_s->method == URL_POST_METHOD		&& !URL_s->expires		 && !cache_method		  && URL_s->history_num)	  {		if(URL_s->force_reload != NET_DONT_RELOAD)		  {			if(!FE_Confirm(window_id, XP_GetString(XP_CONFIRM_REPOST_FORMDATA)))			  {				XP_ListRemoveObject(net_EntryList, this_entry);				net_CallExitRoutine(exit_routine,									URL_s,									MK_INTERRUPTED,									output_format,									window_id);				/* will get decremented */				net_CheckForWaitingURL(window_id, this_entry->protocol, 									   load_background);				PR_Free(this_entry);  /* not needed any more */				LIBNET_UNLOCK_AND_RETURN(MK_INTERRUPTED);			  }			/* otherwise fall through and repost			 */		  }		else		  {			NET_StreamClass * stream;			char buffer[1000];			StrAllocCopy(URL_s->content_type, TEXT_HTML);			stream =  NET_StreamBuilder(CLEAR_CACHE_BIT(output_format),										URL_s,										window_id);			if(stream)			  {				PL_strcpy(buffer, XP_GetString(XP_HTML_MISSING_REPLYDATA));				(*stream->put_block)(stream,									 buffer,									 PL_strlen(buffer));				(*stream->complete)(stream);			  }			XP_ListRemoveObject(net_EntryList, this_entry);			net_CallExitRoutine(exit_routine,								URL_s,								MK_INTERRUPTED,								output_format,								window_id);			net_CheckForWaitingURL(window_id, this_entry->protocol,								   load_background);			PR_Free(this_entry);  /* not needed any more */			LIBNET_UNLOCK_AND_RETURN(MK_INTERRUPTED);		  }	  }redo_load_switch:   /* come here on file/ftp retry */	/* This code path handles the case when a pac/global file has been loaded	 * and we now want to use it in for a request. If we find a proxy/socks	 * server to use, we call NET_HTTPLoad here, skipping the below switch.	 * See mkautocf.c for more info. */	pacf_status = TRUE;	if ((NET_ProxyAcLoaded || NET_GlobalAcLoaded) 		&& (this_entry->protocol == HTTP_TYPE_URL			|| this_entry->protocol == SECURE_HTTP_TYPE_URL			|| this_entry->protocol == GOPHER_TYPE_URL			|| this_entry->protocol == FTP_TYPE_URL			|| this_entry->protocol == WAIS_TYPE_URL			|| this_entry->protocol == URN_TYPE_URL			|| this_entry->protocol == NFS_TYPE_URL			|| (this_entry->protocol == NEWS_TYPE_URL 				&& !PL_strncasecmp(URL_s->address, "snews:", 6)				)			)		&& (this_entry->proxy_conf =		     pacf_find_proxies_for_url(window_id, URL_s)) != NULL		&& (pacf_status = pacf_get_proxy_addr(window_id,							 this_entry->proxy_conf,							 &this_entry->proxy_addr,							 &this_entry->socks_host,							 &this_entry->socks_port))		&& this_entry->proxy_addr		)	  {		TRACEMSG(("PAC returned \"%s\" for \"%s\".", this_entry->proxy_conf, URL_s->address));		/* Secure protocols need to be kept in their own protocol		 * to make SSL tunneling happen. */		if (this_entry->protocol != SECURE_HTTP_TYPE_URL 			&& this_entry->protocol != NEWS_TYPE_URL) {				this_entry->protocol = HTTP_TYPE_URL;		}		/* Everything else except SNEWS gets loaded by HTTP loader,		 * including HTTPS. */		if (this_entry->protocol != NEWS_TYPE_URL) {			this_entry->proto_impl = net_get_protocol_impl(HTTP_TYPE_URL);		} else {			this_entry->proto_impl = net_get_protocol_impl(NEWS_TYPE_URL);		}		if(this_entry->proto_impl)			status = (*this_entry->proto_impl->init)(this_entry);	  }	else if ( pacf_status == FALSE && NET_GetNoProxyFailover() == TRUE ) 	  {		status = MK_UNABLE_TO_LOCATE_PROXY;		FE_Alert(window_id, XP_GetString(XP_BAD_AUTOCONFIG_NO_FAILOVER));      } 	else	  {		  char *proxy_address = NET_FindProxyHostForUrl(type, this_entry->URL_s->address);		  		  if(proxy_address)			{				this_entry->protocol = HTTP_TYPE_URL;				this_entry->proxy_addr = proxy_address;			}					  this_entry->proto_impl = net_get_protocol_impl(this_entry->protocol);		  if(this_entry->proto_impl)		  {			status = (*this_entry->proto_impl->init)(this_entry);		  }		  else		  {				/* bad url */				URL_s->error_msg =					NET_ExplainErrorDetails(MK_MALFORMED_URL_ERROR,											this_entry->URL_s->address);				status = MK_MALFORMED_URL_ERROR;				this_entry->status = MK_MALFORMED_URL_ERROR;		  }	}	/* the entry is no longer busy	 */	this_entry->busy = FALSE;#ifdef MOZILLA_CLIENT    /* OH NASTY A GOTO!     * If we went into load file and what we really wanted to do     * was use FTP, LoadFile will return MK_USE_FTP_INSTEAD so     * we will go back up to the beginning of the switch and     * use ftp instead     */    if(status == MK_USE_FTP_INSTEAD)      {		type = FTP_TYPE_URL;	    this_entry->protocol = type; /* change protocol designator */		this_entry->status = 0; /* reset */		goto redo_load_switch;      }	else #endif /* MOZILLA_CLIENT */	if(this_entry->status == MK_USE_COPY_FROM_CACHE)	  {	    TRACEMSG(("304 Not modified recieved using cached entry\n"));#ifdef MOZILLA_CLIENT	    NET_RefreshCacheFileExpiration(this_entry->URL_s);#endif /* MOZILLA_CLIENT */		/* turn off force reload by telling it to use local copy		 */		this_entry->URL_s->use_local_copy = TRUE;	    /* restart the transfer	     */		XP_ListRemoveObject(net_EntryList, this_entry);	    status = NET_GetURL(this_entry->URL_s,				   this_entry->format_out,				   this_entry->window_id,				   this_entry->exit_routine);		net_CheckForWaitingURL(this_entry->window_id,							   this_entry->protocol,							   this_entry->URL_s->load_background);		PR_Free(this_entry);		LIBNET_UNLOCK_AND_RETURN(0);	  }	else if(this_entry->status == MK_DO_REDIRECT)	  {		/* this redirect should just call GetURL again		 */		int status;		XP_ListRemoveObject(net_EntryList, this_entry);		status =NET_GetURL(this_entry->URL_s, 						   this_entry->format_out,						   this_entry->window_id,						   this_entry->exit_routine);		net_CheckForWaitingURL(this_entry->window_id, 							   this_entry->protocol,							   load_background);		PR_Free(this_entry);  /* not needed any more */		LIBNET_UNLOCK_AND_RETURN(0);	  }    else if(this_entry->status == MK_TOO_MANY_OPEN_FILES)      {		/* Queue this URL so it gets tried again		 */		XP_ListRemoveObject(net_EntryList, this_entry);		status = net_push_url_on_wait_queue(						NET_URL_Type(this_entry->URL_s->address),						this_entry->URL_s,						this_entry->format_out,						this_entry->window_id,						this_entry->exit_routine);		NET_TotalNumberOfProcessingURLs--;		PR_Free(this_entry);		LIBNET_UNLOCK_AND_RETURN(status);      }    else if(this_entry->status == MK_OFFLINE)      {		/*  Stop the stars and put up a nice message		 */		XP_ListRemoveObject(net_EntryList, this_entry);		{			if (window_id->type != MWContextMail && window_id->type != MWContextMailMsg &&				(CLEAR_CACHE_BIT(output_format) != FO_INTERNAL_IMAGE) &&				(CLEAR_CACHE_BIT(output_format) != FO_EMBED) &&				(CLEAR_CACHE_BIT(output_format) != FO_PLUGIN) &&				(CLEAR_CACHE_BIT(output_format) != FO_DO_JAVA))			{				/* We only display the message for top-level items (i.e., not for				   inline images, plugins, or java classes */				   				char * alert = PL_strdup(XP_GetString(XP_ALERT_OFFLINE_MODE_SELECTED));				FE_Alert(window_id, alert);				FREE(alert);			}		}				net_CallExitRoutine(this_entry->exit_routine,							this_entry->URL_s,							this_entry->status,							this_entry->format_out,							this_entry->window_id);		/* Check for WaitingURL decrements TotalNumberofProcessingURLS */		net_CheckForWaitingURL(this_entry->window_id, 							   this_entry->protocol,							   load_background);		PR_Free(this_entry);		LIBNET_UNLOCK_AND_RETURN(MK_OFFLINE);      }    if(status < 0)  /* check for finished state */      {        /* XP_OS2_FIX IBM-MAS: limit length of output string to keep from blowing trace buffer */      TRACEMSG(("End of transfer, entry (soc=%d, con=%d) being removed from list with %d status: %-.1900s",             this_entry->socket, this_entry->con_sock, this_entry->status,             this_entry->URL_s->address));		XP_ListRemoveObject(net_EntryList, this_entry);		net_CallExitRoutine(this_entry->exit_routine,							this_entry->URL_s,							this_entry->status,							this_entry->format_out,							this_entry->window_id);		net_CheckForWaitingURL(this_entry->window_id, 							   this_entry->protocol,							   load_background);		PR_Free(this_entry);  /* not needed any more */      }    TRACEMSG(("Leaving GetURL with %d items in list",			  XP_ListCount(net_EntryList)));	/* XXX - hack for chromeless windows - jsw 10/27/95 */	LIBNET_UNLOCK();	if ( processcallbacks ) {		NET_ProcessExitCallbacks();	}		return status;#ifdef NOTDEF /* this is the real code here */    LIBNET_UNLOCK_AND_RETURN(status);#endif}