diff --git a/netwerk/protocol/ftp/src/nsFTPChannel.h b/netwerk/protocol/ftp/src/nsFTPChannel.h index d3f75902e5cc..c473d3616d56 100644 --- a/netwerk/protocol/ftp/src/nsFTPChannel.h +++ b/netwerk/protocol/ftp/src/nsFTPChannel.h @@ -45,6 +45,9 @@ #define FTP_COMMAND_CHANNEL_SEG_SIZE 64 #define FTP_COMMAND_CHANNEL_MAX_SIZE 512 +#define FTP_DATA_CHANNEL_SEG_SIZE (32*1024) +#define FTP_DATA_CHANNEL_MAX_SIZE (256*1024) + #define NS_FTP_BUFFER_READ_SIZE (8*1024) #define NS_FTP_BUFFER_WRITE_SIZE (8*1024) diff --git a/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp b/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp index 029143f37e60..46abf34725e4 100644 --- a/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp +++ b/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp @@ -353,7 +353,11 @@ nsFtpState::EstablishControlConnection() nsCOMPtr transport; // build our own - rv = CreateTransport(host, mPort, getter_AddRefs(transport)); // the command transport + rv = CreateTransport(host, + mPort, + FTP_COMMAND_CHANNEL_SEG_SIZE, + FTP_COMMAND_CHANNEL_MAX_SIZE, + getter_AddRefs(transport)); // the command transport if (NS_FAILED(rv)) return rv; mState = FTP_READ_BUF; @@ -1543,7 +1547,11 @@ nsFtpState::R_pasv() { const char* hostStr = mIPv6ServerAddress ? mIPv6ServerAddress : host.GetBuffer(); // now we know where to connect our data channel - rv = CreateTransport(hostStr, port, getter_AddRefs(mDPipe)); // the data channel + rv = CreateTransport(hostStr, + port, + FTP_DATA_CHANNEL_SEG_SIZE, + FTP_DATA_CHANNEL_MAX_SIZE, + getter_AddRefs(mDPipe)); // the data channel if (NS_FAILED(rv)) return FTP_ERROR; PR_LOG(gFTPLog, PR_LOG_DEBUG, ("(%x) Created Data Transport (%s:%d)\n", this, hostStr, port)); @@ -1993,7 +2001,7 @@ nsFtpState::SetDirMIMEType(nsString& aString) { } nsresult -nsFtpState::CreateTransport(const char * host, PRInt32 port, nsITransport** o_pTrans) +nsFtpState::CreateTransport(const char * host, PRInt32 port, PRUint32 bufferSegmentSize, PRUint32 bufferMaxSize, nsITransport** o_pTrans) { nsresult rv; @@ -2025,21 +2033,24 @@ nsFtpState::CreateTransport(const char * host, PRInt32 port, nsITransport** o_pT if (NS_SUCCEEDED(rv) && nsCRT::strcasecmp(proxyType, "socks") == 0) { return sts->CreateTransportOfType("socks", host, port, proxyHost, proxyPort, - FTP_COMMAND_CHANNEL_SEG_SIZE, - FTP_COMMAND_CHANNEL_MAX_SIZE, o_pTrans); + bufferSegmentSize, + bufferMaxSize, + o_pTrans); } return sts->CreateTransport(host, port, proxyHost, proxyPort, - FTP_COMMAND_CHANNEL_SEG_SIZE, - FTP_COMMAND_CHANNEL_MAX_SIZE, o_pTrans); + bufferSegmentSize, + bufferMaxSize, + o_pTrans); } } return sts->CreateTransport(host, port, nsnull, -1, - FTP_COMMAND_CHANNEL_SEG_SIZE, - FTP_COMMAND_CHANNEL_MAX_SIZE, o_pTrans); + bufferSegmentSize, + bufferMaxSize, + o_pTrans); } nsresult diff --git a/netwerk/protocol/ftp/src/nsFtpConnectionThread.h b/netwerk/protocol/ftp/src/nsFtpConnectionThread.h index 9db0e392ecb4..0375d8a3f595 100644 --- a/netwerk/protocol/ftp/src/nsFtpConnectionThread.h +++ b/netwerk/protocol/ftp/src/nsFtpConnectionThread.h @@ -140,7 +140,9 @@ private: void SetDirMIMEType(nsString& aString); nsresult Process(); + virtual nsresult CreateTransport(const char * host, PRInt32 port, + PRUint32 bufferSegmentSize, PRUint32 bufferMaxSize, nsITransport** o_pTrans); void KillControlConnnection();