Skip to main content
Grzegorz Kania
Associate II
Jul 23, 2021 6:13 AM UTC
Question

LwIP/httpd - problem with using custom_file with LWIP_HTTPD_DYNAMIC_FILE_READ

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

This topic has been closed for replies.

7 replies

Walid ZRELLI
Visitor II
Aug 17, 2021 1:28 PM UTC

Hello @Community member​ ,

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

Thanks in advance.

BeST Regards,

Walid

Pavel A.
Aug 17, 2021 1:45 PM UTC

You can compare with the latest LwIP version here.

Unlikely that they still have a bug.

Walid ZRELLI
Visitor II
Aug 18, 2021 9:29 AM UTC

Hello @Community member​ ,

The issue has been raised internally.

Thank you for reporting this out.

BeST Regards,

Walid

Walid ZRELLI
Visitor II
Aug 18, 2021 9:29 AM UTC

ST Internal Reference: 112036 

KHeig.1
Visitor II
Feb 24, 2022 1:20 PM UTC

Hello, is there any solution ?

KHeig.1
Visitor II
Feb 24, 2022 1:59 PM UTC

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 II
Feb 26, 2022 12:13 PM UTC

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.