Bug 60952: nsMimeTypes.h has wrong type for APPLICATION_HTTP_INDEX, author=Bradley Baetz <bbaetz@cs.mcgill.ca>, r=blake, sr=darin

Bug 68651, nsFtpConnectionThread should use NS_LITERAL_STRING, author=Bradley Baetz <bbaetz@cs.mcgill.ca>, r=jag, sr=dougt
This commit is contained in:
disttsc%bart.nl 2001-03-24 22:57:35 +00:00
parent 07dee1c311
commit 385f89696c
9 changed files with 27 additions and 25 deletions

View File

@ -691,8 +691,8 @@ typedef struct _mdata {
#ifndef APPLICATION_GZIP2
#define APPLICATION_GZIP2 "application/gzip"
#endif
#ifndef APPLICATION_HTTP_INDEX
#define APPLICATION_HTTP_INDEX "application/http-index"
#ifndef APPLICATION_HTTP_INDEX_FORMAT
#define APPLICATION_HTTP_INDEX_FORMAT "application/http-index-format"
#endif
#ifndef APPLICATION_JAVASCRIPT
#define APPLICATION_JAVASCRIPT "application/x-javascript"

View File

@ -167,7 +167,7 @@ nsFileIO::Open(char **contentType, PRInt32 *contentLength)
// Directories turn into an HTTP-index stream, with
// unbounded (i.e., read 'til the stream says it's done)
// length.
*contentType = nsCRT::strdup("application/http-index-format");
*contentType = nsCRT::strdup(APPLICATION_HTTP_INDEX_FORMAT);
*contentLength = -1;
}
else {

View File

@ -36,6 +36,7 @@
#include "nsIMIMEService.h"
#include "nsISupportsUtils.h"
#include "prio.h"
#include "nsMimeTypes.h"
//static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kFileTransportServiceCID, NS_FILETRANSPORTSERVICE_CID);
@ -500,7 +501,7 @@ nsDiskCacheRecordChannel::GetContentType(char * *aContentType)
nsresult rv;
PRBool isDirectory;
if ( NS_SUCCEEDED(mSpec->IsDirectory(&isDirectory)) && isDirectory) {
*aContentType = nsCRT::strdup("application/http-index-format");
*aContentType = nsCRT::strdup(APPLICATION_HTTP_INDEX_FORMAT);
return *aContentType ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
else {

View File

@ -45,7 +45,7 @@
#define APPLICATION_FORTEZZA_KRL "application/x-fortezza-krl"
#define APPLICATION_GZIP "application/x-gzip"
#define APPLICATION_GZIP2 "application/gzip"
#define APPLICATION_HTTP_INDEX "application/http-index"
#define APPLICATION_HTTP_INDEX_FORMAT "application/http-index-format"
#define APPLICATION_JAVASCRIPT "application/x-javascript"
#define APPLICATION_NETSCAPE_REVOCATION "application/x-netscape-revocation"
#define APPLICATION_NS_PROXY_AUTOCONFIG "application/x-ns-proxy-autoconfig"

View File

@ -343,7 +343,7 @@ nsFileChannel::GetContentType(char * *aContentType)
PRBool directory;
mFile->IsDirectory(&directory);
if (directory) {
mContentType = "application/http-index-format";
mContentType = APPLICATION_HTTP_INDEX_FORMAT;
}
else {
nsCOMPtr<nsIMIMEService> MIMEService(do_GetService(NS_MIMESERVICE_CONTRACTID, &rv));

View File

@ -45,6 +45,7 @@
#include "nsIMemory.h"
#include "nsIStringStream.h"
#include "nsIPref.h"
#include "nsMimeTypes.h"
#ifdef DOUGT_NEW_CACHE
#include "nsIInputStreamTee.h"
@ -1045,11 +1046,10 @@ nsFtpState::S_user() {
if (!mPrompter) return NS_ERROR_NOT_INITIALIZED;
PRUnichar *user = nsnull, *passwd = nsnull;
PRBool retval;
nsAutoString message;
nsXPIDLCString host;
rv = mURL->GetHost(getter_Copies(host));
if (NS_FAILED(rv)) return rv;
message.AssignWithConversion("Enter username and password for "); //TODO localize it!
nsAutoString message(NS_LITERAL_STRING("Enter username and password for ")); //TODO localize it!
message.AppendWithConversion(host);
nsAutoString realm; // XXX i18n
@ -1125,16 +1125,14 @@ nsFtpState::S_pass() {
PRUnichar *passwd = nsnull;
PRBool retval;
nsAutoString message;
nsAutoString title;
title.AssignWithConversion("Password");
nsAutoString title(NS_LITERAL_STRING("Password"));
nsXPIDLCString host;
rv = mURL->GetHost(getter_Copies(host));
if (NS_FAILED(rv)) return rv;
message.AssignWithConversion("Enter password for "); //TODO localize it!
nsAutoString message(NS_LITERAL_STRING("Enter password for ")); //TODO localize it!
message += mUsername;
message.AppendWithConversion(" on ");
message.Append(NS_LITERAL_STRING(" on "));
message.AppendWithConversion(host);
nsXPIDLCString prePath;
@ -1195,7 +1193,7 @@ nsFtpState::R_pass() {
nsresult
nsFtpState::S_syst() {
nsCString systString( nsLiteralCString( "SYST" CRLF) );
nsCString systString("SYST" CRLF);
return SendFTPCommand( systString );
}
@ -1225,7 +1223,7 @@ nsFtpState::R_syst() {
nsresult
nsFtpState::S_acct() {
nsCString acctString( nsLiteralCString( "ACCT noaccount" CRLF) );
nsCString acctString("ACCT noaccount" CRLF);
return SendFTPCommand(acctString);
}
@ -1239,7 +1237,7 @@ nsFtpState::R_acct() {
nsresult
nsFtpState::S_pwd() {
nsCString pwdString( nsLiteralCString("PWD" CRLF) );
nsCString pwdString("PWD" CRLF);
return SendFTPCommand(pwdString);
}
@ -1461,7 +1459,7 @@ nsFtpState::S_list() {
NS_WITH_SERVICE(nsIStreamConverterService, streamConvService, kStreamConverterServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
nsAutoString fromStr; fromStr.AssignWithConversion("text/ftp-dir-");
nsAutoString fromStr(NS_LITERAL_STRING("text/ftp-dir-"));
SetDirMIMEType(fromStr);
#ifdef DOUGT_NEW_CACHE
@ -1487,7 +1485,7 @@ nsFtpState::S_list() {
}
} else {
rv = streamConvService->AsyncConvertData(fromStr.GetUnicode(),
NS_LITERAL_STRING("application/http-index-format").get(),
NS_LITERAL_STRING(APPLICATION_HTTP_INDEX_FORMAT).get(),
listener, mURL, getter_AddRefs(converterListener));
}
@ -1513,7 +1511,7 @@ nsFtpState::S_list() {
if (mGenerateHTMLContent)
rv = mChannel->SetContentType("text/html");
else
rv = mChannel->SetContentType("application/http-index-format");
rv = mChannel->SetContentType(APPLICATION_HTTP_INDEX_FORMAT);
nsCOMPtr<nsITransport> transport;
rv = mCacheEntry->GetTransport(getter_AddRefs(transport));
@ -2219,13 +2217,13 @@ nsFtpState::SetDirMIMEType(nsString& aString) {
// "text/ftp-dir-SERVER_TYPE" where SERVER_TYPE represents the server we're talking to.
switch (mServerType) {
case FTP_UNIX_TYPE:
aString.AppendWithConversion("unix");
aString.Append(NS_LITERAL_STRING("unix"));
break;
case FTP_NT_TYPE:
aString.AppendWithConversion("nt");
aString.Append(NS_LITERAL_STRING("nt"));
break;
default:
aString.AppendWithConversion("generic");
aString.Append(NS_LITERAL_STRING("generic"));
}
}

View File

@ -288,7 +288,7 @@ nsGopherChannel::GetContentType(char* *aContentType) {
*aContentType = nsCRT::strdup(TEXT_HTML);
break;
case '1':
*aContentType = nsCRT::strdup("application/http-index-format");
*aContentType = nsCRT::strdup(APPLICATION_HTTP_INDEX_FORMAT);
break;
case '2': // CSO search - unhandled, should not be selectable
*aContentType = nsCRT::strdup(TEXT_HTML);

View File

@ -38,6 +38,8 @@
#include "nsDateTimeFormatCID.h"
#include "nsIStreamListener.h"
#include "nsCRT.h"
#include "nsMimeTypes.h"
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kLocaleServiceCID, NS_LOCALESERVICE_CID);
@ -234,7 +236,7 @@ nsFTPDirListingConv::AsyncConvertData(const PRUnichar *aFromType, const PRUnicha
rv = NS_NewInputStreamChannel(&mPartChannel,
uri,
nsnull,
"application/http-index-format",
APPLICATION_HTTP_INDEX_FORMAT,
-1); // XXX fix contentLength
NS_RELEASE(uri);
if (NS_FAILED(rv)) return rv;

View File

@ -36,6 +36,7 @@
#include "nsIStringStream.h"
#include "nsIStreamObserver.h"
#include "nsNetUtil.h"
#include "nsMimeTypes.h"
#include "nsGopherDirListingConv.h"
@ -147,7 +148,7 @@ nsGopherDirListingConv::AsyncConvertData(const PRUnichar *aFromType,
rv = NS_NewInputStreamChannel(&mPartChannel,
mUri,
nsnull,
"application/http-index-format",
APPLICATION_HTTP_INDEX_FORMAT,
-1);
if (NS_FAILED(rv)) return rv;