Skip to content

Commit dd63831

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 1faae93 + b3cc2c9 commit dd63831

File tree

6 files changed

+34
-34
lines changed

6 files changed

+34
-34
lines changed

FtpServer.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,8 @@ uint8_t FtpServer::handleFTP() {
294294
void FtpServer::clientConnected()
295295
{
296296
DEBUG_PRINTLN( F(" Client connected!") );
297-
client.print(F("220---")); client.print(welcomeMessage); client.println(F(" ---"));
298-
client.println(F("220--- By Renzo Mischianti ---"));
297+
client.print(F("220 --- ")); client.print(welcomeMessage); client.println(F(" ---"));
298+
client.println(F("220 --- By Renzo Mischianti ---"));
299299
client.print(F("220 -- Version ")); client.print(FTP_SERVER_VERSION); client.println(F(" --"));
300300
iCL = 0;
301301
if (FtpServer::_callback) {
@@ -393,7 +393,7 @@ bool FtpServer::processCommand()
393393
//
394394
else if( CommandIs( "FEAT" ))
395395
{
396-
client.println(F("211-Extensions suported:"));
396+
client.println(F("211-Extensions supported:"));
397397
client.println(F(" MLST type*;modify*;size*;") );
398398
client.println(F(" MLSD") );
399399
client.println(F(" MDTM") );
@@ -507,7 +507,7 @@ bool FtpServer::processCommand()
507507
if( ParameterIs( "S" )) {
508508
client.println(F("200 S Ok") );
509509
} else {
510-
client.println(F("504 Only S(tream) is suported") );
510+
client.println(F("504 Only S(tream) is supported") );
511511
}
512512
}
513513
//
@@ -589,7 +589,7 @@ bool FtpServer::processCommand()
589589
// else if( ParameterIs( "R" ))
590590
// client.println(F("200 B Ok") );
591591
}else{
592-
client.println(F("504 Only F(ile) is suported") );
592+
client.println(F("504 Only F(ile) is supported") );
593593
}
594594
}
595595
//
@@ -602,7 +602,7 @@ bool FtpServer::processCommand()
602602
} else if( ParameterIs( "I" )) {
603603
client.println(F("200 TYPE is now 8-bit binary") );
604604
} else {
605-
client.println(F("504 Unknow TYPE") );
605+
client.println(F("504 Unknown TYPE") );
606606
}
607607
}
608608

@@ -712,8 +712,8 @@ bool FtpServer::processCommand()
712712
client.println(F("200 OK, UTF8 ON") );
713713
DEBUG_PRINTLN(F("200 OK, UTF8 ON") );
714714
} else {
715-
client.println(F("504 Unknow OPTS") );
716-
DEBUG_PRINTLN(F("504 Unknow OPTS") );
715+
client.println(F("504 Unknown OPTS") );
716+
DEBUG_PRINTLN(F("504 Unknown OPTS") );
717717
}
718718
}
719719
//
@@ -991,14 +991,14 @@ bool FtpServer::processCommand()
991991
}
992992
}
993993
else {
994-
client.print( F("500 Unknow SITE command ") ); client.println( parameter );
994+
client.print( F("500 Unknown SITE command ") ); client.println( parameter );
995995
}
996996
}
997997
//
998998
// Unrecognized commands ...
999999
//
10001000
else
1001-
client.println(F("500 Unknow command") );
1001+
client.println(F("500 Unknown command") );
10021002
return true;
10031003
}
10041004

@@ -1154,7 +1154,7 @@ bool FtpServer::doRetrieve()
11541154
bytesTransfered += nb;
11551155

11561156
if (FtpServer::_transferCallback) {
1157-
FtpServer::_transferCallback(FTP_DOWNLOAD, getFileName(&file), bytesTransfered);
1157+
FtpServer::_transferCallback(FTP_DOWNLOAD, getFileName(&file).c_str(), bytesTransfered);
11581158
}
11591159

11601160
// RoSchmi
@@ -1200,7 +1200,7 @@ bool FtpServer::doStore()
12001200

12011201
if (FtpServer::_transferCallback) {
12021202

1203-
FtpServer::_transferCallback(FTP_UPLOAD, getFileName(&file), bytesTransfered);
1203+
FtpServer::_transferCallback(FTP_UPLOAD, getFileName(&file).c_str(), bytesTransfered);
12041204
}
12051205
}
12061206
if( nb < 0 || rc == nb ) {
@@ -1725,7 +1725,7 @@ bool FtpServer::doMlsd()
17251725
dir.close();
17261726
#endif
17271727
data.stop();
1728-
DEBUG_PRINTLN(F("All file readed!!"));
1728+
DEBUG_PRINTLN(F("All file read!!"));
17291729
return false;
17301730
}
17311731

@@ -1738,7 +1738,7 @@ void FtpServer::closeTransfer()
17381738
DEBUG_PRINT( bytesTransfered / deltaT ); DEBUG_PRINTLN( F(" kbytes/s") );
17391739

17401740
if (FtpServer::_transferCallback) {
1741-
FtpServer::_transferCallback(FTP_TRANSFER_STOP, getFileName(&file), bytesTransfered);
1741+
FtpServer::_transferCallback(FTP_TRANSFER_STOP, getFileName(&file).c_str(), bytesTransfered);
17421742
}
17431743

17441744

@@ -1758,7 +1758,7 @@ void FtpServer::abortTransfer()
17581758
if( transferStage != FTP_Close )
17591759
{
17601760
if (FtpServer::_transferCallback) {
1761-
FtpServer::_transferCallback(FTP_TRANSFER_ERROR, getFileName(&file), bytesTransfered);
1761+
FtpServer::_transferCallback(FTP_TRANSFER_ERROR, getFileName(&file).c_str(), bytesTransfered);
17621762
}
17631763

17641764
file.close();
@@ -2095,8 +2095,8 @@ char * FtpServer::makeDateTimeStr( char * tstr, uint16_t date, uint16_t time )
20952095
}
20962096

20972097

2098-
uint32_t FtpServer::fileSize( FTP_FILE file ) {
2099-
#if (STORAGE_TYPE == STORAGE_SPIFFS || STORAGE_TYPE == STORAGE_LITTLEFS || STORAGE_TYPE == STORAGE_FFAT || STORAGE_TYPE == STORAGE_SD || STORAGE_TYPE == STORAGE_SD_MMC || STORAGE_TYPE == STORAGE_SEEED_SD)
2098+
uint32_t FtpServer::fileSize( FTP_FILE & file ) {
2099+
#if (STORAGE_TYPE == STORAGE_SDFAT2 || STORAGE_TYPE == STORAGE_SPIFFS || STORAGE_TYPE == STORAGE_LITTLEFS || STORAGE_TYPE == STORAGE_FFAT || STORAGE_TYPE == STORAGE_SD || STORAGE_TYPE == STORAGE_SD_MMC || STORAGE_TYPE == STORAGE_SEEED_SD)
21002100
return file.size();
21012101
#else
21022102
return file.fileSize();
@@ -2250,7 +2250,7 @@ bool FtpServer::isDir( char * path )
22502250
// if (strcmp(path, "/") == 0) return true;
22512251
// res = file.isDirectory();
22522252
// DEBUG_PRINT(path);
2253-
// DEBUG_PRINT(" IS DIRECOTORY --> ");
2253+
// DEBUG_PRINT(" IS DIRECTORY --> ");
22542254
// DEBUG_PRINTLN(res);
22552255
return true;
22562256
#else

FtpServer.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@
489489
#define DEBUG_PRINTLN(...) {}
490490
#endif
491491

492-
#define FTP_CMD_PORT 21 // Command port on wich server is listening
492+
#define FTP_CMD_PORT 21 // Command port on which server is listening
493493
#define FTP_DATA_PORT_DFLT 20 // Default data port in active mode
494494
#define FTP_DATA_PORT_PASV 50009 // Data port in passive mode
495495

@@ -514,8 +514,8 @@ enum ftpTransfer { FTP_Close = 0, // In this stage, close data channel
514514
FTP_Nlst, // list of name of files
515515
FTP_Mlsd }; // listing for machine processing
516516

517-
enum ftpDataConn { FTP_NoConn = 0,// No data connexion
518-
FTP_Pasive, // Pasive type
517+
enum ftpDataConn { FTP_NoConn = 0,// No data connection
518+
FTP_Pasive, // Passive type
519519
FTP_Active }; // Active type
520520

521521
enum FtpOperation {
@@ -596,17 +596,17 @@ class FtpServer
596596
#endif
597597
int8_t readChar();
598598

599-
const char* getFileName(FTP_FILE *file){
599+
const String getFileName(FTP_FILE *file){
600600
#if STORAGE_TYPE <= STORAGE_SDFAT2
601601
int max_characters = 100;
602602
char f_name[max_characters];
603-
file->getName(f_name, max_characters);
603+
file->getName(f_name, sizeof(f_name));
604604
String filename = String(f_name);
605-
return filename.c_str();
605+
return filename;
606606
#elif STORAGE_TYPE == STORAGE_FATFS
607-
return file->fileName();
607+
return String(file->fileName());
608608
#else
609-
return file->name();
609+
return String(file->name());
610610
#endif
611611
}
612612
bool exists( const char * path ) {
@@ -650,7 +650,7 @@ class FtpServer
650650
#endif
651651
// bool openFile( char path[ FTP_CWD_SIZE ], const char * readType );
652652
// bool openFile( const char * path, const char * readType );
653-
uint32_t fileSize( FTP_FILE file );
653+
uint32_t fileSize( FTP_FILE & file );
654654

655655
#if STORAGE_TYPE == STORAGE_SPIFFS || STORAGE_TYPE == STORAGE_LITTLEFS
656656
#if ESP8266 || ARDUINO_ARCH_RP2040
@@ -728,9 +728,9 @@ class FtpServer
728728
FTP_FILE file;
729729
FTP_DIR dir;
730730

731-
ftpCmd cmdStage; // stage of ftp command connexion
732-
ftpTransfer transferStage; // stage of data connexion
733-
ftpDataConn dataConn; // type of data connexion
731+
ftpCmd cmdStage; // stage of ftp command connection
732+
ftpTransfer transferStage; // stage of data connection
733+
ftpDataConn dataConn; // type of data connection
734734

735735
bool anonymousConnection = false;
736736

examples/ESP32_AP_FFAT_WiFi/ESP32_AP_FFAT_WiFi.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void setup(void){
104104
#endif
105105

106106
/////FTP Setup, ensure FFAT is started before ftp; /////////
107-
Serial.print(F("Inizializing FS..."));
107+
Serial.print(F("Initializing FS..."));
108108
if (FFat.begin(true)){
109109
Serial.println(F("done."));
110110
}else{

examples/ESP32_FFAT_WiFi/ESP32_FFAT_WiFi.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void setup(void){
8585
Serial.println(WiFi.localIP());
8686

8787
/////FTP Setup, ensure FFAT is started before ftp; /////////
88-
Serial.print(F("Inizializing FS..."));
88+
Serial.print(F("Initializing FS..."));
8989
if (FFat.begin(true)){
9090
Serial.println(F("done."));
9191
}else{

examples/ESP32_SPIFM_WiFi/ESP32_SPIFM_WiFi.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void setup()
110110
Serial.println(WiFi.subnetMask());
111111

112112
if (flash.begin()) {
113-
Serial.println(F("Device finded and supported!"));
113+
Serial.println(F("Device found and supported!"));
114114
} else {
115115
Serial.println(F("Problem to discover and configure device, check wiring also!"));
116116
while(1) yield();

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version=2.1.8
33
author=Renzo Mischianti <[email protected]>
44
maintainer=Renzo Mischianti <[email protected]>
55
sentence=Simple FTP server for esp8266, esp32, STM32, Raspberry Pi Pico and Arduino
6-
paragraph=Simple FTP server for Raspberry Pi Pico W (LittleFS), esp8266 (SPIFFS and LittleFS or SD, SdFat 2.x), esp32 (SPIFFS, LittleFS and FFAT or SD, SdFat 2.x) and Arduino (SdFat, SD basic lib with 8.3 file format), Wio Terminal (Seed_SD, SdFat 2.x), Arduino MKR (SdFat 2), STM32 (Flash >64K SdFat 2.x and SPI Flash). Support w5500, w5100 and enc28j60. With internal callback to chck the phase of communication.
6+
paragraph=Simple FTP server for Raspberry Pi Pico W (LittleFS), esp8266 (SPIFFS and LittleFS or SD, SdFat 2.x), esp32 (SPIFFS, LittleFS and FFAT or SD, SdFat 2.x) and Arduino (SdFat, SD basic lib with 8.3 file format), Wio Terminal (Seed_SD, SdFat 2.x), Arduino MKR (SdFat 2), STM32 (Flash >64K SdFat 2.x and SPI Flash). Support w5500, w5100 and enc28j60. With internal callback to check the phase of communication.
77
category=Communication
88
url=https://www.mischianti.org/category/my-libraries/simple-ftp-server/
99
repository=https://github.com/xreef/SimpleFTPServer.git

0 commit comments

Comments
 (0)