FileCentipede icon indicating copy to clipboard operation
FileCentipede copied to clipboard

File centipede does not see all files in the FTP directory

Open polyakoff opened this issue 3 years ago • 11 comments

Please provide as much information as possible.

version(>=2.0) : 2.82

screenshot: image

URL: not able to share

I set up an ftp server using FileZilla and Windows server 2016 for transferring big amount of large files. FileCentipede allows downloading them at faster speeds than FileZilla client, WinSCP and Cyberduck (which is quite paradoxical as they are FTP clients in the first place). I succesfully connected to the server (though storing the pass in the settings is not intuitive and initiating connection with ftp connect string ftp://username:pass@server did not work as expected). I can see only the first 35 files out of 142 available on the server, which makes impossible to queue all the files I need. I appreciate the download speed of FileCentipede, but this issue is critical for me. Would appreciate fixing it, or glad to try fixing it myself — if someone points the direction where to look for the problem.

Thanks!

polyakoff avatar Mar 26 '23 19:03 polyakoff

FileCentipede sends the command "LIST $filepath" to the FTP server Got 150 code Receive the file list Got 226 code Parsing file list Deliver the parsed list to FileBrowser

void list_type::on_pasv_data(uint8_t* data,size_t size)
{
    received_data_.append((const char*)data,size);

    if(received_data_.size() > 16_MB){
        this->close({(int)std::errc::no_buffer_space,std::system_category()});
    }
}

void list_type::on_pasv_done(ext::error_code error)
{
    Ext_Return_If(done_);

    done_ = true;
}

void list_type::start(const ext::text& path,on_list_type&& callback)
{
    path_    = path;
    on_list_ = std::move(callback);

    connection_->send_command("LIST",path_,150,[this,Ext_Shared_This](auto error,const auto& message)
    {
        message_ = message;

        if(error){
            return close(error);
        }
        receive_data();
        connection_->receive_message(226,[this,Ext_Shared_This](auto error,const auto& message)
        {
            message_ = message;

            if(error){
                return close(error);
            }
            done_ = true;
            on_list_(error,error ? std::vector<file_info_t>{} : parse_file_list((uint8_t*)received_data_.data(),received_data_.size()));
            //receive_data();
        });
    });

}
std::vector<file_info_t> parse_file_list(uint8_t* data,size_t size)
{
    std::vector<file_info_t> list;
    std::string 		     temp;

    file_info_t	file;
    uint8_t     column = 0;
    uint32_t    line 	= 0;
    char        last   = 0;

    for(size_t i=0;i<size;++i)
    {
        auto c = data[i];

        if(c == '\r'){
            continue;
        }else if(std::isspace(c))
        {
            if(column == 8 && c != '\n'){
                goto append_char;
            }
            if(temp.empty()){
                continue;
            }
            file(column++,temp);

            if(c == '\n'){
                line++;
                column = 0;

                if((file.type = parse_file_type(file.access)) == ext::fs::file_type::symlink){
                    file.parse_name();
                }
                if(file.name != "." && file.name != ".."){
                    list.emplace_back(std::move(file));
                }
                file.clear();
            }
            temp.clear();
        }else{
            append_char:
            temp += c;
        }
    }
    return list;
}

Please use the LIST command in the command line to get the file list manually, if the result is not the same as FileCentipede, you must provide me a full filename list so I can test it on my side.

filecxx avatar Mar 27 '23 03:03 filecxx

@filecxx Thank you for the prompt reply. I used ftp command in windows cmd to connect to the server, then ls to list all the files, and I was able to see all 142 of them. Other ftp clients like WinSCP are able to see all files as well. Do you want me to provide the test account credentials so you can log in and test this yourself?

I reckon this might be related to truncation of a received data message because of a wrong message size, since I am able to see only the first 30-something files from the list, the rest are ommitted.

polyakoff avatar Mar 28 '23 16:03 polyakoff

Sure, please send the test account to my image

I'll fix it.

filecxx avatar Mar 28 '23 17:03 filecxx

Sure, please send the test account to my image

I'll fix it.

Email sent, thanks!

polyakoff avatar Mar 30 '23 13:03 polyakoff

But, I haven't received it yet?

filecxx avatar Mar 30 '23 16:03 filecxx

But, I haven't received it yet?

@filecxx just re-sent from another mailbox.

polyakoff avatar Mar 30 '23 17:03 polyakoff

Still haven't received it, try copying the email address from the bottom of http://filecxx.com

filecxx avatar Mar 30 '23 18:03 filecxx

Still haven't received it, try copying the email address from the bottom of http://filecxx.com

@filecxx Copied and tried one more time.

polyakoff avatar Mar 30 '23 18:03 polyakoff

Thank you, I'll test the "humanCentipede" as soon as possible.

filecxx avatar Mar 30 '23 19:03 filecxx

I have fixed this issue.

The problem occurred because the FTP server sent the 226 code before the file list was received on the main connection.

filecxx avatar Apr 01 '23 17:04 filecxx

@filecxx Great, thank you so much!

polyakoff avatar Apr 02 '23 07:04 polyakoff