1
votes

I'm developing a FTP server, and I would need the file size before the STOR happens, I have seen that there is a command called ALLO, and I was wondering if there is a way to force the client to issue that command, because the client, of course, knows the file size before hand.

Cheers.

2

2 Answers

2
votes

I think @Rob Adams is going the right direction, but I disagree with sending 552, which says you are aborting the transfer; I think that holding the request until they send ALLO is a more useful approach. Reading through RFC 959:

        This (ALLO) command may be required by some servers to reserve
        sufficient storage to accommodate the new file to be
        transferred...

Section 4.2 lists the valid format of replies, where you can display the error on the first line, and elaborate on the requirement for ALLO on the 2nd line.

Furthermore, Section 4.2.2 lists this message... 350 Requested file action pending further information.

It seems reasonable that if your server receives a request to store before recieving an ALLO, it should throw a 350 and hold the transfer until either you get a session timeout, close or they send an ALLO.

2
votes

Just a guess -- you could return 552 - Exceeded storage allocation (for current directory or dataset). for the STOR.