cancel
Showing results for 
Search instead for 
Did you mean: 

LwIP/httpd - problem with using custom_file with LWIP_HTTPD_DYNAMIC_FILE_READ

Grzegorz Kania
Associate III

The problem is with LwIP codes. I know that the topic is a bit different from this forum. But I ask, maybe someone had similar :)

When I use custom_file with the LWIP_HTTPD_DYNAMIC_FILE_READ flag, the data is sent to the browser twice.

I was looking at the code from the httpd.c file and it seems to me that in the http_init_file function around line 2358

is

   if (file-> is_custom_file && (file-> data == NULL) ) {

and I think it should be

   if (file-> is_custom_file) {

Can anyone confirm this?

Grzegorz

7 REPLIES 7

Hello @Community member​ ,

Can you provide the stm32 MCU used and the LwIP version?

Thanks in advance.

BeST Regards,

Walid

Pavel A.
Evangelist III

You can compare with the latest LwIP version here.

Unlikely that they still have a bug.

Hello @Community member​ ,

The issue has been raised internally.

Thank you for reporting this out.

BeST Regards,

Walid

ST Internal Reference: 112036 

KHeig.1
Associate II

Hello, is there any solution ?

KHeig.1
Associate II

Hello again, Solution:

you need to set the file->data = NULL in fs_open_custom().

then everything works fine !

Would be great to find this solution somewhere in the documentation.

Grzegorz Kania
Associate III

Hi

I found it possible to do this, but it is not a good solution. You cannot use the file-> data pointer as the actual pointer to an open pseudo-file because it must be NULL. The pointer to the open file must be saved in an external variable. It would be nice to use the file->data pointer for this. I was reviewing the code in terms of this possibility: the place I indicated earlier is the only one that would need to be changed. The rest is fine.