From 94f842b81e2857b59ac52f9cf5df6eb51f4a8076 Mon Sep 17 00:00:00 2001 From: "valeski%netscape.com" Date: Tue, 29 Jun 1999 23:28:15 +0000 Subject: [PATCH] very temporary gross necko hack to force an text/html content type in the file and http protocols --- netwerk/protocol/file/src/nsFileChannel.cpp | 13 ++++++++++++- netwerk/protocol/http/src/nsHTTPChannel.cpp | 14 +++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/netwerk/protocol/file/src/nsFileChannel.cpp b/netwerk/protocol/file/src/nsFileChannel.cpp index 1e8442b78ef9..5bb8032954e6 100644 --- a/netwerk/protocol/file/src/nsFileChannel.cpp +++ b/netwerk/protocol/file/src/nsFileChannel.cpp @@ -34,6 +34,7 @@ #include "nsISimpleEnumerator.h" #include "nsIURL.h" #include "prio.h" +#include "prmem.h" // XXX can be removed when we start doing real content-type discovery static NS_DEFINE_CID(kEventQueueService, NS_EVENTQUEUESERVICE_CID); NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); @@ -438,10 +439,20 @@ nsFileChannel::SetLoadAttributes(PRUint32 aLoadAttributes) return NS_OK; } +#define DUMMY_TYPE "text/html" + NS_IMETHODIMP nsFileChannel::GetContentType(char * *aContentType) { - return NS_ERROR_NOT_IMPLEMENTED; + // XXX temporary hack until we have a contenttype strategy + *aContentType = new char[PL_strlen(DUMMY_TYPE) + 1]; + if (!*aContentType) + return NS_ERROR_OUT_OF_MEMORY; + + PL_strcpy(*aContentType, DUMMY_TYPE); + return NS_OK; + + //return NS_ERROR_NOT_IMPLEMENTED; } //////////////////////////////////////////////////////////////////////////////// diff --git a/netwerk/protocol/http/src/nsHTTPChannel.cpp b/netwerk/protocol/http/src/nsHTTPChannel.cpp index 851413bc7a5d..961c35d851ec 100644 --- a/netwerk/protocol/http/src/nsHTTPChannel.cpp +++ b/netwerk/protocol/http/src/nsHTTPChannel.cpp @@ -25,6 +25,7 @@ #include "nsIChannel.h" #include "nsIInputStream.h" #include "nsIStreamListener.h" +#include "prmem.h" // XXX can be removed when we start doing real content-type discovery #include "nsIHttpNotify.h" #include "nsINetModRegEntry.h" @@ -210,10 +211,21 @@ nsHTTPChannel::SetLoadAttributes(PRUint32 aLoadAttributes) return NS_OK; } + +#define DUMMY_TYPE "text/html" + NS_IMETHODIMP nsHTTPChannel::GetContentType(char * *aContentType) { - return NS_ERROR_NOT_IMPLEMENTED; + // XXX temporary hack until we have a contenttype strategy + *aContentType = new char[PL_strlen(DUMMY_TYPE) + 1]; + if (!*aContentType) + return NS_ERROR_OUT_OF_MEMORY; + + PL_strcpy(*aContentType, DUMMY_TYPE); + return NS_OK; + + //return NS_ERROR_NOT_IMPLEMENTED; } ////////////////////////////////////////////////////////////////////////////////