Skip to main content
Grzegorz Kania
Associate II
July 23, 2021
Question

LwIP/httpd - problem with using custom_file with LWIP_HTTPD_DYNAMIC_FILE_READ

  • July 23, 2021
  • 7 replies
  • 1947 views

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
August 17, 2021

Hello @Community member​ ,

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

Thanks in advance.

BeST Regards,

Walid

Pavel A.
August 17, 2021

You can compare with the latest LwIP version here.

Unlikely that they still have a bug.

Walid ZRELLI
Visitor II
August 18, 2021

Hello @Community member​ ,

The issue has been raised internally.

Thank you for reporting this out.

BeST Regards,

Walid

Walid ZRELLI
Visitor II
August 18, 2021

ST Internal Reference: 112036 

KHeig.1
Visitor II
February 24, 2022

Hello, is there any solution ?

KHeig.1
Visitor II
February 24, 2022

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
February 26, 2022

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.