FTP now uses the unknown content-type when it can't find one for the file it's transferring

This commit is contained in:
valeski%netscape.com 1999-09-15 00:04:32 +00:00
Родитель 88b33233c5
Коммит 9740197525
2 изменённых файлов: 7 добавлений и 4 удалений

Просмотреть файл

@ -334,7 +334,6 @@ nsFTPChannel::SetLoadAttributes(PRUint32 aLoadAttributes)
// FTP does not provide a file typing mechanism. We fallback to file
// extension mapping.
#define FTP_DUMMY_TYPE "text/html"
NS_IMETHODIMP
nsFTPChannel::GetContentType(char* *aContentType) {
nsresult rv = NS_OK;
@ -368,7 +367,7 @@ nsFTPChannel::GetContentType(char* *aContentType) {
// if all else fails treat it as text/html?
if (!*aContentType)
*aContentType = nsCRT::strdup(FTP_DUMMY_TYPE);
*aContentType = nsCRT::strdup("application/x-unknown-content-type");
if (!*aContentType) {
rv = NS_ERROR_OUT_OF_MEMORY;
} else {

Просмотреть файл

@ -1439,9 +1439,13 @@ nsFtpConnectionThread::R_retr() {
char *contentType;
rv = MIMEService->GetTypeFromURI(mUrl, &contentType);
if (NS_FAILED(rv)) return FTP_ERROR;
dataCtxt->SetContentType(contentType);
// if we fail, we want to push the data on up anyway. let the app figure
// out what to do.
if (NS_SUCCEEDED(rv)) {
dataCtxt->SetContentType(contentType);
}
nsISupports *ctxtSup = nsnull;
rv = dataCtxt->QueryInterface(NS_GET_IID(nsISupports), (void**)&ctxtSup);