The httpd/fs still send data directly from file->data buffer after
fs_open_custom(...) instead of calling fs_read_custom (to feed a chunk of
I have to set file->data = NULL (inside fs_open_custom) to make http call
int fs_open_custom(struct fs_file *file, const char *name)
... open file...
file->data = (const char *)p_web->buf_ptr; -> will not call 'fs_open_custom'
First, sorry for the wrong comments, it should be 'fs_read_custom' instead of
I think the two options work as following:
1. LWIP_HTTPD_CUSTOM_FILES = 1 -> user app should provide fs_open_custom to
feed file data buffer to the file->data pointer, and the httpd can use
2. LWIP_HTTPD_DYNAMIC_FILE_READ = 1 -> the httpd should ALWAYS call
fs_read_custom to feed data before each sending, it should NOT use file->data.
User App can set file->data to a specific value (maybe used later in the
fs_read_custom), and httpd shall NOT use it.
The bug I see here is for the 2nd options (LWIP_HTTPD_DYNAMIC_FILE_READ = 1):
when file->data != NULL, httpd use this pointer to send out data, it does not
I did use file->pextension. At first time using dynamic reading, I use
'file->pextention' to store request information (ex: uri) and use 'file->data'
for response information (file handle, status...). But if 'file->data' not
NULL, the read function is not called, so i have to group all information to
'pextension' only. Of course, we can add other fields to fs_file struct but
this is informal.
Here i want to talk about the logic of the calling: the fs_read_custom shall
always be called to feed data; the httpd shall not automatically load data
(even from file->data).