Renaming Files - Implementation

Moderator: Project members

Post Reply
Message
Author
dartonw
500 Command not understood
Posts: 1
Joined: 2005-05-24 20:26

Renaming Files - Implementation

#1 Post by dartonw » 2005-05-24 21:01

I noticed when replacing a commercial FTP server with FileZilla that the implementation of renaming (RNFR, RNTO) differs slightly from that of the commercial software. I've looked all over for recommendations on implementing these commands, but have found nothing definitive. Here's what I found:

Most commercial FTP servers seem to agree with the way it's done in FileZilla. If there are two files in a directory, file1 and file2, the client cannot rename "file1" to "file2", as this would overwrite without any confirmation. However, the commercial FTP product I was using did allow this. The clients connecting to it (AXIS camera servers sending JPEGs) actually relied on this nonstandard behavior to upload a file with a .tmp extension and send a rename command to overwrite the existing JPEG. The result of this was a single .tmp file and a single .jpg file in the upload directory, with the .tmp being overwritten by the upload and then actually copied in-place to the .jpg file. As it turns out, this is the only way these cameras will upload their images properly.

I made a patch specifically for this server, simply replacing the error on line 1368 of ControlSocket.cpp (FZS v0.9.8a):
else if (error & PERMISSION_DOESALREADYEXIST && (error & PERMISSION_DIRNOTFILE)!=PERMISSION_DIRNOTFILE) Send("550 file exists");
Instead of sending 550, I used CopyFile() with the bFailIfExists parameter set to false.

My point is, has anyone else run into or had a need to deal with this sort of behavior? I find it strange that I had commercial FTP software running for years and it just happened to work properly with the crazy firmware on those camera servers.

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

Re: Renaming Files - Implementation

#2 Post by boco » 2008-04-02 08:10

FZ Server 0.9.8a? Why you're using such ancient versions? Latest is 0.9.25.
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

Post Reply