cancel
Showing results for 
Search instead for 
Did you mean: 

STM32Cube Ver 4.26.1 "LWIP_HTTPD_DYNAMIC_HEADERS" setting

New.Fish
Associate III

I use STM32Cube Ver 4.26.1 to generate LWIP code with HTTPD, it keep print "Assertion "HTTP headers not included in file system" failed at line 2271 in ..\Middlewares\Third_Party\LwIP\src\apps\httpd\httpd.c " .

I find it is in file "httpd_opts.h", " LWIP_HTTPD_DYNAMIC_HEADERS" is not defined.

From Cube ==>Configuration ==>LWIP ==> HTTPD, nowhere can I define " LWIP_HTTPD_DYNAMIC_HEADERS".

Any suggestions?

1 ACCEPTED SOLUTION

Accepted Solutions
Nawres GHARBI
ST Employee

Hi @Zhang.Sam

You can activate this define from the LWIP configuration window

Open the configuration window

Switch to HTTPD tab

Enable LWIP_HTTPD

Search for the needed parameter and you will found it (be sure the advanced checkbox is checked)

View solution in original post

2 REPLIES 2

This refers to the method how the files which are to be served are stored - with or without the headers sent out before the "webpage" itself.

In the "normal" incarnations of lwip there's a utility attached to be used to generate the "filesystem", called makefsdata, that can generate the "filesystem" (fsdata.c) with or without the headers. In the generated fsdata.c, every "file" has a fsdata_file struct which describes that "file", and one of its fields is http_header_included (which, while declared as u8, is in fact a boolean value). The assert above says, that "header for this file is not included, and I don't know how to generate headers dynamically".

Quoting from httpd.c:

 * By default, the server assumes that HTTP headers are already present in

 * each file stored in the file system. By defining LWIP_HTTPD_DYNAMIC_HEADERS in

 * lwipopts.h, this behavior can be changed such that the server inserts the

 * headers automatically based on the extension of the file being served. If

 * this mode is used, be careful to ensure that the file system image used

 * does not already contain the header information.

 *

 * File system images without headers can be created using the makefsfile

 * tool with the -h command line option.

I don't Cube/CubeMX so can't comment on what you can or cannot achieve by wildly clicking.

JW

Nawres GHARBI
ST Employee

Hi @Zhang.Sam

You can activate this define from the LWIP configuration window

Open the configuration window

Switch to HTTPD tab

Enable LWIP_HTTPD

Search for the needed parameter and you will found it (be sure the advanced checkbox is checked)