network/module/Makefile -

1. 310133 - Added nsIRefreshUrl.h to the list of exports.

network/module/makefile.win -
1. 310133 - Added nsIRefreshUrl.h to the list of exports.

network/module/nsIHttpUrl.h -
1. 310133 - Extended the nsIHttpUrl interface to include the AddMimeHeader() method which adds an http header to the url.

network/module/nsHttpUrl.cpp -
310133 - 1. Added support for the AddMimeHeader() method so http urls can have headers added outside of the actual data retrieval in netlib. This method calls NET_ParseMimeHeader() directly.
2. Added a public member, a pointer to the netlib URL_Struct that was created for this nsHttpUrlImpl. This pointer is the link between netlib and the outside world; the adhesive agent between url structs and nsURLImpls.

network/module/nsNetStream.h -
1. 310133 - Added a public memeber variable to nsConnectionInfo. It's a bool that tells us whether or not a redirect has occurred.

network/module/nsNetStream.cpp -
1. 310133 - Added initialization (FALSE) of new redirect member.

network/module/nsNetStubs.cpp -
1. 310133 - Implemented FE_SetRefreshURLTimer(). This function is called from NET_GetURL() when we recognize that we have a url to refresh.

network/module/nsStubContext.cpp -
1. 310133 - Added check to see if we're redirecting in stub_complete() which gets called when a stream completes. If we are, we don't want to release/destroy the pConsumer, this will happen in nsNetService's bam_exit_routine().

network/module/nsNetService.cpp -
1. 310133 - added nsConnectionInfo->redirect check in bam_exit_routine() so we give the consumer a successful binding event if the consumer is still around. This is iffy.


git-svn-id: svn://10.0.0.236/trunk@7956 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
valeski%netscape.com
1998-08-13 20:10:49 +00:00
parent 3deae00620
commit 09a03524ca
9 changed files with 142 additions and 12 deletions

View File

@@ -28,6 +28,8 @@
#include "prmem.h"
#include "plstr.h"
MWContext *new_stub_context(URL_Struct *URL_s);
static NS_DEFINE_IID(kIOutputStreamIID, NS_IOUTPUTSTREAM_IID);
@@ -57,6 +59,12 @@ public:
NS_IMETHOD SendData(const char *aBuffer, PRInt32 aLength);
NS_IMETHOD SendDataFromFile(const char *aFile);
/* Handle http-equiv meta tags. */
NS_IMETHOD AddMimeHeader(const char *name, const char *value);
/* Here's our link to the netlib world.... */
URL_Struct *m_URL_s;
/* nsIHttpUrl interface... */
@@ -81,6 +89,7 @@ nsHttpUrlImpl::nsHttpUrlImpl(nsISupports* outer)
m_PostType = Send_None;
m_PostBuffer = nsnull;
m_PostBufferLength = 0;
m_URL_s = nsnull;
}
nsHttpUrlImpl::~nsHttpUrlImpl()
@@ -132,6 +141,9 @@ NS_METHOD nsHttpUrlImpl::InitializeURLInfo(URL_Struct *URL_s)
{
nsresult result = NS_OK;
/* Hook us up with the world. */
m_URL_s = URL_s;
if (Send_None != m_PostType) {
/* Free any existing POST data hanging off the URL_Struct */
if (nsnull != URL_s->post_data) {
@@ -213,6 +225,59 @@ done:
}
NS_METHOD nsHttpUrlImpl::AddMimeHeader(const char *name, const char *value)
{
MWContext *stubContext=NULL;
char *aName=NULL;
char *aVal=NULL;
PRBool addColon=TRUE;
PRInt32 len=0;
NS_PRECONDITION((name != nsnull) && ((*name) != nsnull), "Bad name");
NS_PRECONDITION((value != nsnull) && ((*value) != nsnull), "Bad value");
if(!name
|| !*name
|| !value
|| !*value)
return NS_FALSE;
// Make sure we've got a colon on the end of the header name
if(PL_strchr(name, ':'))
addColon=FALSE;
/* Bring in our own copies of the data. */
if(addColon)
aName = (char*)PR_Malloc(PL_strlen(name)+2); // add extra byte for colon
else
aName = (char*)PR_Malloc(PL_strlen(name)+1);
if(!aName)
return NS_ERROR_OUT_OF_MEMORY;
aVal = (char*)PR_Malloc(PL_strlen(value)+1);
if(!aVal)
return NS_ERROR_OUT_OF_MEMORY;
PL_strcpy(aName, name);
if(addColon) {
PL_strcat(aName, ":");
}
PL_strcpy(aVal, value);
stubContext = new_stub_context(m_URL_s);
/* Make the real call to NET_ParseMimeHeader, passing in the dummy bam context. */
NET_ParseMimeHeader(FO_CACHE_AND_NGLAYOUT,
stubContext,
m_URL_s,
aName,
aVal,
TRUE);
return NS_OK;
}
nsresult nsHttpUrlImpl::PostFile(const char *aFile)
{
nsresult result = NS_OK;