stype = NP_NORMAL;
stype = (uint) stype2 = NP_NORMAL;
np_newstream(URL_Struct *urls, np_handle *handle, np_instance *instance){    NET_StreamClass *nstream = nil;    NPStream *pstream = nil;    np_stream *stream = nil;    uint16 stype;	XP_Bool alreadyLocal;    XP_Bool b1;	XP_Bool b2;    /* make a netlib stream */    if (!(nstream = XP_NEW_ZAP(NET_StreamClass)))         return 0;	/* make the plugin stream data structures */	stream = np_makestreamobjects(instance, nstream, urls);	if (!stream)	{        XP_FREE(nstream);        return 0;	}	pstream = stream->pstream;	stream->prev_stream = NULL;	    /* Let us treat mailbox as remote too       Not doing so causes problems with some attachments (Adobe)    */    b1 = NET_IsURLInDiskCache(stream->initial_urls);    b2 = (XP_STRNCASECMP(urls->address, "mailbox:", 8) == 0) ? 0 : NET_IsLocalFileURL(urls->address);    alreadyLocal = b1 || b2;      /* determine if the stream is seekable */    if (urls->server_can_do_byteranges || alreadyLocal)    {    	/*    	 * Zero-length streams are never seekable.    	 * This will force us to download the entire    	 * stream if a byterange request is made.    	 */    	if (urls->content_length > 0)        	stream->seekable = 1;    }    /* and call the plugin */    instance->reentrant = 1;    stype = NP_NORMAL;    TRACEMSG(("npglue.c: CallNPP_NewStreamProc"));    if (handle->userPlugin) {        nsPluginInstancePeer* peerInst = (nsPluginInstancePeer*)instance->npp->pdata;        nsIPluginInstance* pluginInst = peerInst->GetPluginInstance();        nsPluginStreamPeer* peerStream = new nsPluginStreamPeer(urls, stream);        if (peerStream == NULL) {            /* XXX where's the error go? */        }        else {            peerStream->AddRef();            nsIPluginStream* userStream;            nsresult err = pluginInst->NewStream(peerStream, &userStream);            if (err == NS_OK && userStream != NULL) {                peerStream->SetUserStream(userStream);                pstream->pdata = peerStream;                nsresult err = userStream->GetStreamType((nsPluginStreamType*)&stype);                PR_ASSERT(err == NS_OK);            }            else {                /* XXX where's the error go? */            }        }        pluginInst->Release();    }    else if (ISFUNCPTR(handle->f->newstream))    {        /*XXX*/CallNPP_NewStreamProc(handle->f->newstream, instance->npp, urls->content_type,                                      pstream, stream->seekable, &stype);    }    if(!instance->reentrant)    {        urls->pre_exit_fn = np_dofetch;        XP_FREE(nstream);       /* will not call abort */        return 0;    }    instance->reentrant = 0;    /* see if its hard */    if(stype == NP_SEEK)    {        if(!stream->seekable)        {            NPTRACE(0,("stream is dumb, force caching"));            stream->seek = 2;        }		/* for a seekable stream that doesn't require caching, in the SSL case, don't cache, because that 		will leave the supposedly secure file laying around in the cache! */		if (   !alreadyLocal 			&& !(XP_STRNCASECMP(urls->address, "https:", 6)==0))        	urls->must_cache = TRUE; 		stream->dontclose++;    }	else if (stype == NP_ASFILE || stype == NP_ASFILEONLY)    {           NPTRACE(0,("stream as file"));        if (!alreadyLocal)        	urls->must_cache = TRUE;        stream->asfile = stype;    }		/*	 * If they want just the file, and the file is local, there's 	 * no need to continue with the netlib stream: just give them	 * the file and we're done.	 */	if (stype == NP_ASFILEONLY)		{		if (urls->cache_file || NET_IsLocalFileURL(urls->address))			{			np_streamAsFile(stream);			np_destroystream(stream, NPRES_DONE);			XP_FREE(nstream);			return NULL;		}    }    /* and populate the netlib stream */    nstream->name           = "plug-in";    nstream->complete       = NPL_Complete;    nstream->abort          = NPL_Abort;    nstream->is_write_ready = NPL_WriteReady;    nstream->put_block      = (MKStreamWriteFunc)NPL_Write;    nstream->data_object    = (void *)urls;    nstream->window_id      = instance->cx;	/* In case of Mailbox->StreamAsFile, use cache code to store, handle... */	if ( ((stype == NP_ASFILE) || (stype == NP_ASFILEONLY)) && 	     ((XP_STRNCASECMP(urls->address, "mailbox:", 8)==0)  	   || (XP_STRNCASECMP(urls->address, "news:"   , 5)==0)	   || (XP_STRNCASECMP(urls->address, "snews:"  , 6)==0))		 		 && 	     (stream != NULL) && 		 (urls->cache_file == NULL)) /* if already cached, is well-handled */	   {    	   urls->must_cache = TRUE;	       stream->prev_stream = NET_StreamBuilder(FO_CACHE_ONLY,urls,instance->cx);	   }    return nstream;}