Patch for PRET-Support in Filezilla 3.3.3

Moderator: Project members

Message
Author
pyro
500 Command not understood
Posts: 4
Joined: 2008-03-25 15:42
First name: Markus
Last name: Miller

Patch for PRET-Support in Filezilla 3.3.3

#1 Post by pyro » 2010-07-26 10:30

Hi folks,

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)
 		{
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.

User avatar
boco
Contributor
Posts: 26913
Joined: 2006-05-01 03:28
Location: Germany

Re: Patch for PRET-Support in Filezilla 3.3.3

#2 Post by boco » 2010-07-26 14:12

as i've seen the aversion of the development team against the PRET command
That's got nothing to do with it. The problem is that PRET is not an FTP command. It's not standardized and there are probably hundreds of different implementations floating around. THAT'S why it's not implemented.
No support requests over PM! You will NOT get any reply!!!
FTP connection problems? Please read Network Configuration.
FileZilla connection test: https://filezilla-project.org/conntest.php
FileZilla Pro support: https://customerforum.fileZilla-project.org

pyro
500 Command not understood
Posts: 4
Joined: 2008-03-25 15:42
First name: Markus
Last name: Miller

Re: Patch for PRET-Support in Filezilla 3.3.3

#3 Post by pyro » 2010-07-26 15:17

ok, i see you're right.

i used this description: http://www.drftpd.org/index.php/PRET_Specifications

User avatar
boco
Contributor
Posts: 26913
Joined: 2006-05-01 03:28
Location: Germany

Re: Patch for PRET-Support in Filezilla 3.3.3

#4 Post by boco » 2010-07-26 18:00

That's made by one entity and is in no way official. There are also posts of botg (the developer) in these forums explaining why PRET could create more problems than it solves.
No support requests over PM! You will NOT get any reply!!!
FTP connection problems? Please read Network Configuration.
FileZilla connection test: https://filezilla-project.org/conntest.php
FileZilla Pro support: https://customerforum.fileZilla-project.org

User avatar
botg
Site Admin
Posts: 35509
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

Re: Patch for PRET-Support in Filezilla 3.3.3

#5 Post by botg » 2010-07-26 18:42

Thanks for your effort.

Unfortunately, PRET is not standardized and the provided documentation is in no way formal enough. In addition, the provided syntax is ambiguous and conflicts with itself:
PRET RETR <file> [ignored arguments]
Where does the file end and the ignored arguments start if there's a command like PRET RETR foo bar?

As such, I cannot apply your patch to FileZilla.

User avatar
EHCanadian
500 Command not understood
Posts: 4
Joined: 2009-11-24 22:44
First name: EH
Last name: Canadian

Re: Patch for PRET-Support in Filezilla 3.3.3

#6 Post by EHCanadian » 2010-08-07 23:51

I think the fact that someone went and did what you basicly refuse to do is more of a insult to pryo.

There is really no reason at all why this could not be branched.

Any other time you offer to implement it with some decent documents but when both devs are just
lazy the comunity looses out casue both want to be stubborn and lazy. A user took insentive and x
hours of his time to do what nether of you felt like doing. While PRET may not be a standard and
geared at only a few applications the fact that supporting it while being under open source and
community driven application.

Hell I'll take his patch and call it... EhZilla... slap on a donate now and be a prick to everyone tooo!
Lag is the #1 killer

User avatar
boco
Contributor
Posts: 26913
Joined: 2006-05-01 03:28
Location: Germany

Re: Patch for PRET-Support in Filezilla 3.3.3

#7 Post by boco » 2010-08-08 01:08

There's only one dev. And he's the one having the last word.
No support requests over PM! You will NOT get any reply!!!
FTP connection problems? Please read Network Configuration.
FileZilla connection test: https://filezilla-project.org/conntest.php
FileZilla Pro support: https://customerforum.fileZilla-project.org

User avatar
botg
Site Admin
Posts: 35509
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

Re: Patch for PRET-Support in Filezilla 3.3.3

#8 Post by botg » 2010-08-08 10:01

Did you even bother to try to understand the technical arguments why I cannot support PRET in its current form?

dev_rand
500 Command not understood
Posts: 1
Joined: 2012-05-29 02:20

Re: Patch for PRET-Support in Filezilla 3.3.3

#9 Post by dev_rand » 2012-05-29 03:05

Hate to revive an (really) old topic, but this seems to be the most appropriate spot for it. After killing a few hours setting up and tweaking my build environment, I got this patch to work and figured I'd make the build available to others since a few people have asked for this feature now and official support won't happen short of an RFC being written.

As it states in the link below, this is completely unsupported - I'm not sure what will work/break/explode. If you find an issue that you have some idea how to fix, feel free to let me know.

Hope this helps somebody!

http://urandom.us/fz_pret/

User avatar
boco
Contributor
Posts: 26913
Joined: 2006-05-01 03:28
Location: Germany

Re: Patch for PRET-Support in Filezilla 3.3.3

#10 Post by boco » 2012-05-29 04:10

No support requests over PM! You will NOT get any reply!!!
FTP connection problems? Please read Network Configuration.
FileZilla connection test: https://filezilla-project.org/conntest.php
FileZilla Pro support: https://customerforum.fileZilla-project.org

FileGamer
450 Internal Error
Posts: 38
Joined: 2014-08-16 06:26

Re: Patch for PRET-Support in Filezilla 3.3.3

#11 Post by FileGamer » 2014-08-16 06:36

I didn't want to make a new topic about PRET support, so I'm replying to this one. Is there a build of Filezilla 3.9 that supports PRET? That link of the Windows build 3.3 on the WIKI page seems to be down, and I'm wondering if there's an updated unofficial build anyway. Unfortunately, a server I use still uses PRET and every time I connect to it, it shows this:

Response: 500 You need to use a client supporting PRET (PRE Transfer) to use PASV
Command: PORT 192,168,1,10,40,163
Response: 501- ==YOU'RE BEHIND A NAT ROUTER==
Response: 501- Configure the firewall settings of your FTP client
Response: 501- to use your real IP: SERVER.IP.IS.HERE
Response: 501- And set up port forwarding in your router.
Response: 501- Or you can just use a PRET capable client, see
Response: 501- http://drftpd.org/ for PRET capable clients
Response: 501
Error: Failed to retrieve directory listing

User avatar
boco
Contributor
Posts: 26913
Joined: 2006-05-01 03:28
Location: Germany

Re: Patch for PRET-Support in Filezilla 3.3.3

#12 Post by boco » 2014-08-16 10:28

No, the official build does not support PRET (as it's not a part of FTP). The 3.5.3 was an unofficial build and seems to be down (unofficial builds are not mirrored).

Examine this list: http://www.drftpd.org/index.php/Clients ... ET_support
No support requests over PM! You will NOT get any reply!!!
FTP connection problems? Please read Network Configuration.
FileZilla connection test: https://filezilla-project.org/conntest.php
FileZilla Pro support: https://customerforum.fileZilla-project.org

FileGamer
450 Internal Error
Posts: 38
Joined: 2014-08-16 06:26

Re: Patch for PRET-Support in Filezilla 3.3.3

#13 Post by FileGamer » 2014-08-22 06:23

boco wrote:No, the official build does not support PRET (as it's not a part of FTP). The 3.5.3 was an unofficial build and seems to be down (unofficial builds are not mirrored).

Examine this list: http://www.drftpd.org/index.php/Clients ... ET_support
If anyone has the installer file for the 3.5.3 unofficial build, I would greatly appreciate it. That mirror in the wiki article has been down for weeks.

User avatar
boco
Contributor
Posts: 26913
Joined: 2006-05-01 03:28
Location: Germany

Re: Patch for PRET-Support in Filezilla 3.3.3

#14 Post by boco » 2014-08-22 22:48

That build is very old and suffers from many issues (security-related ones included). Get an up-to-date client, instead.
No support requests over PM! You will NOT get any reply!!!
FTP connection problems? Please read Network Configuration.
FileZilla connection test: https://filezilla-project.org/conntest.php
FileZilla Pro support: https://customerforum.fileZilla-project.org

FileGamer
450 Internal Error
Posts: 38
Joined: 2014-08-16 06:26

Re: Patch for PRET-Support in Filezilla 3.3.3

#15 Post by FileGamer » 2014-08-23 05:47

boco wrote:That build is very old and suffers from many issues (security-related ones included). Get an up-to-date client, instead.
The thing is, I need an FTP client that uses PRET (the servers I connect to use that), maxes out my download/upload speeds, has Auth TLS, and can perform simultaneous transfers. I've tried every client on that list that works with Windows 7 (both 32-bit or 64-bit). I've tried both FTP Rush v1 and v2, and both have bugs for me including giving several download errors with a red X as well as not maxing out my speed and giving me way less both uploading and downloading. FlashFXP gives me a little bit in better speeds, still a lot less than my internet speed, but doesn't have the capability to do simultaneous transfers. Keep in mind, I'm connecting to servers with much faster speeds than what I have for internet. All the other clients on that list and even others I've tried like cuteFTP or smartFTP or other ones mentioned online do not fulfill the requirements. If I knew how to give Filezilla PRET support in my own unofficial build, I wouldn't be here complaining. But Filezilla has everything except PRET support.

Post Reply