Skip to content

Commit a0343ad

Browse files
committed
Added FileSystemHTTP with naive HTTP support
1 parent b7cba98 commit a0343ad

File tree

14 files changed

+968
-29
lines changed

14 files changed

+968
-29
lines changed

fujinet_pc.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ set(SOURCES src/main.cpp
172172
lib/FileSystem/fnFsTNFS.h lib/FileSystem/fnFsTNFS.cpp
173173
lib/FileSystem/fnFsSMB.h lib/FileSystem/fnFsSMB.cpp
174174
lib/FileSystem/fnFsFTP.h lib/FileSystem/fnFsFTP.cpp
175+
lib/FileSystem/fnFsHTTP.h lib/FileSystem/fnFsHTTP.cpp
175176
lib/FileSystem/fnFile.h lib/FileSystem/fnFile.cpp
176177
lib/FileSystem/fnFileLocal.h lib/FileSystem/fnFileLocal.cpp
177178
lib/FileSystem/fnFileTNFS.h lib/FileSystem/fnFileTNFS.cpp
@@ -190,6 +191,7 @@ set(SOURCES src/main.cpp
190191
lib/fnjson/fnjson.h lib/fnjson/fnjson.cpp
191192
components_pc/mongoose/mongoose.h components_pc/mongoose/mongoose.c
192193
lib/webdav/WebDAV.h lib/webdav/WebDAV.cpp
194+
lib/webdav/IndexParser.h lib/webdav/IndexParser.cpp
193195
lib/http/httpService.h lib/http/mgHttpService.cpp
194196
lib/http/httpServiceParser.h lib/http/httpServiceParser.cpp
195197
lib/http/httpServiceConfigurator.h lib/http/httpServiceConfigurator.cpp

lib/FileSystem/fnFS.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ const char * FileSystem::type_to_string(fsType type)
8888
return "FS_SMB";
8989
case FSTYPE_FTP:
9090
return "FS_FTP";
91+
case FSTYPE_HTTP:
92+
return "FS_HTTP";
9193
default:
9294
return "UNKNOWN FS TYPE";
9395
}

lib/FileSystem/fnFS.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ enum fsType
3939
FSTYPE_TNFS,
4040
FSTYPE_SMB,
4141
FSTYPE_FTP,
42+
FSTYPE_HTTP,
4243
FSTYPE_COUNT
4344
};
4445

lib/FileSystem/fnFileMem.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88

99
FileHandlerMem::FileHandlerMem() : _buffer(nullptr), _size(0), _filesize(0), _position(0)
1010
{
11-
Debug_println("new FileHandlerMem");
11+
// Debug_println("new FileHandlerMem");
1212
};
1313

1414

1515
FileHandlerMem::~FileHandlerMem()
1616
{
17-
Debug_println("delete FileHandlerMem");
17+
// Debug_println("delete FileHandlerMem");
1818
free(_buffer);
1919
}
2020

2121

2222
int FileHandlerMem::close(bool destroy)
2323
{
24-
Debug_println("FileHandlerMem::close");
24+
// Debug_println("FileHandlerMem::close");
2525
int result = 0;
2626
if (destroy) delete this;
2727
return result;
@@ -30,7 +30,7 @@ int FileHandlerMem::close(bool destroy)
3030

3131
int FileHandlerMem::seek(long int off, int whence)
3232
{
33-
Debug_println("FileHandlerMem::seek");
33+
// Debug_println("FileHandlerMem::seek");
3434
long int new_pos;
3535
switch (whence)
3636
{
@@ -61,21 +61,21 @@ int FileHandlerMem::seek(long int off, int whence)
6161
return -1;
6262

6363
_position = new_pos;
64-
Debug_printf("new pos is %lu\n", new_pos);
64+
// Debug_printf("new pos is %lu\n", new_pos);
6565
return 0;
6666
}
6767

6868

6969
long int FileHandlerMem::tell()
7070
{
71-
Debug_println("FileHandlerMem::tell");
71+
// Debug_println("FileHandlerMem::tell");
7272
return _position;
7373
}
7474

7575

7676
size_t FileHandlerMem::read(void *ptr, size_t size, size_t count)
7777
{
78-
Debug_println("FileHandlerMem::read");
78+
// Debug_println("FileHandlerMem::read");
7979

8080
size_t requested = size * count;
8181
size_t available = _filesize - _position;
@@ -93,7 +93,7 @@ size_t FileHandlerMem::read(void *ptr, size_t size, size_t count)
9393

9494
size_t FileHandlerMem::write(const void *ptr, size_t size, size_t count)
9595
{
96-
Debug_println("FileHandlerMem::write");
96+
// Debug_println("FileHandlerMem::write");
9797

9898
size_t requested = size * count;
9999
size_t available = _size - _position;
@@ -120,7 +120,7 @@ size_t FileHandlerMem::write(const void *ptr, size_t size, size_t count)
120120

121121
int FileHandlerMem::flush()
122122
{
123-
Debug_println("FileHandlerMem::flush");
123+
// Debug_println("FileHandlerMem::flush");
124124
return 0;
125125
}
126126

@@ -130,7 +130,7 @@ int FileHandlerMem::flush()
130130
int FileHandlerMem::grow(long filesize)
131131
{
132132
long bufsize = 1024 * ((filesize + 1023) / 1024);
133-
Debug_printf("FileHandlerMem::grow - file size / buffer size: %ld / %ld\n", filesize, bufsize > _size ? bufsize : _size);
133+
// Debug_printf("FileHandlerMem::grow - file size / buffer size: %ld / %ld\n", filesize, bufsize > _size ? bufsize : _size);
134134
// grow buffer, if needed
135135
if (bufsize > _size)
136136
{

lib/FileSystem/fnFsFTP.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#define MAX_CACHE_MEMFILE_SIZE 204800
1313

1414
#include "mbedtls/md5.h"
15-
void get_md5_string(const unsigned char *buf, size_t size, char *result)
15+
static void get_md5_string(const unsigned char *buf, size_t size, char *result)
1616
{
1717
unsigned char md5_result[16];
1818
mbedtls_md5(buf, size, md5_result);

lib/FileSystem/fnFsFTP.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class FileSystemFTP : public FileSystem
1717
// parsed FTP URL
1818
std::unique_ptr<PeoplesUrlParser> _url;
1919

20-
// fnFTP instance
20+
// FTP client
2121
fnFTP *_ftp;
2222

2323
// directory cache

0 commit comments

Comments
 (0)