Patch for PRET-Support in Filezilla 3.3.3
Posted: 2010-07-26 10:30
Hi folks,
In the last 3 hours i managed to create a patch which adds PRET-support to filezilla:
The code works for me quite well. Downloading, Uploading an listing files works without problems.
I do not expect that the patch will be applied to the current development branch as i've seen the aversion of the development team against the PRET command. i just post it here so that other people can compile their own filezilla-versions.
In the last 3 hours i managed to create a patch which adds PRET-support to filezilla:
Code: Select all
--- filezilla-3.3.3/src/engine/ftpcontrolsocket.cpp 2010-06-13 19:13:28.000000000 +0000
+++ filezilla-3.3.3-pret-support/src/engine/ftpcontrolsocket.cpp 2010-07-26 12:06:49.132993558 +0000
@@ -91,6 +91,7 @@ enum rawtransferStates
{
rawtransfer_init = 0,
rawtransfer_type,
+ rawtransfer_pret,
rawtransfer_port_pasv,
rawtransfer_rest,
rawtransfer_transfer,
@@ -3991,7 +3992,12 @@ int CFtpControlSocket::Transfer(const wx
if ((pData->pOldData->binary && m_lastTypeBinary == 1) ||
(!pData->pOldData->binary && m_lastTypeBinary == 0))
- pData->opState = rawtransfer_port_pasv;
+ {
+ if (pData->bPasv && CServerCapabilities::GetCapability(*m_pCurrentServer, pret_command) == yes)
+ pData->opState = rawtransfer_pret;
+ else
+ pData->opState = rawtransfer_port_pasv;
+ }
else
pData->opState = rawtransfer_type;
@@ -4026,10 +4032,25 @@ int CFtpControlSocket::TransferParseResp
error = true;
else
{
- pData->opState = rawtransfer_port_pasv;
+ if (pData->bPasv && CServerCapabilities::GetCapability(*m_pCurrentServer, pret_command) == yes)
+ pData->opState = rawtransfer_pret;
+ else
+ pData->opState = rawtransfer_port_pasv;
m_lastTypeBinary = pData->pOldData->binary ? 1 : 0;
}
break;
+
+ case rawtransfer_pret:
+ if (code != 2 && code != 2)
+ {
+ error = true;
+ }
+ else
+ {
+ pData->opState = rawtransfer_port_pasv;
+ }
+ break;
+
case rawtransfer_port_pasv:
if (code != 2 && code != 3)
{
@@ -4180,6 +4201,13 @@ int CFtpControlSocket::TransferSend()
else
cmd = _T("TYPE A");
break;
+
+ case rawtransfer_pret:
+ cmd = _T("PRET ");
+ cmd += pData->cmd;
+
+ break;
+
case rawtransfer_port_pasv:
if (pData->bPasv)
{
I do not expect that the patch will be applied to the current development branch as i've seen the aversion of the development team against the PRET command. i just post it here so that other people can compile their own filezilla-versions.