mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
FTP now uses the unknown content-type when it can't find one for the file it's transferring
This commit is contained in:
parent
0c1d97b591
commit
8a900bcfe5
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user