cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP server - convert html file to C data array for in memory storage ? Does anybody have a good example.

brj2
Associate II

Been looking into the Azure RTOS offering for the STM32 series, which seems very nice and interesting :smiling_face_with_smiling_eyes:

I have been using another vendor TCP/IP stack for many years, implementing web servers for our products. Looking at the http server examples, I am missing a way to convert html files into c data arrays that can be stored in flash memory and having special tags in the html code that will trigger a web server function for filling in dynamic data as the page output is build.

From looking at the Azure RTOS Iperf example, the html output is created very much manually from small fragments of html code, mixed with dynamic data.

As NetX is a mature product, I would expect it to have this kind of functionality built-in ?

Has anybody here seen a better example ?

Best regards

Brian

4 REPLIES 4
Haithem Rahmani
ST Employee

Hi Brian,

Could you have a look at the NetXDuo WebServer examples in the X-CUBE-AZRTOS-H7?

In particular the callback webserver_request_notify_callback() where you can add you custom processing of the received request.

please let us know if this helps.

regards

haithem.

brj2
Associate II

Hi Haithem,

Thank for your suggestion.

I have looked at the code, it certainly is possible to implement my own handlers for the different URL endpoints/pages.

I was hoping that Azure RTOS had a built-in scheme to implement having multiple pages, and being able to insert dynamic data into those pages while they

are being rendered (before sending it back to the browser).

In another forum, somebody suggested looking at realtimelogic.com, they advocate using SPA (single page application using websockets), especially if you also

want to be using TLS.

Having a "good" webserver and SNMP support is a central to my project, so I am trying to evaluate whether Azure RTOS is the right choice for my projects.

regards

Brian

Hello

Inside stm32 repository the folder C:\Users\user\STM32Cube\Repository\STM32Cube_FW_F4_V1.26.0\Middlewares\Third_Party\LwIP\src\apps\http\makefsdata contains an html to c converter in c source code with a lot of options!. It can convert whole sites with subdirectories, generate HTML1.0 or 1.1 headers , and more. makefsdata.c can be compiled to an executable.

brj2
Associate II

Hi Vangelis,

Thank you for bringing this up.

LwIP is a cool open source project and I like the html to c converter, it functionality is similar to another tool I used before.

Also the SSI (Server Side Includes) options implements a nice way

to have special tags in the html code which is replaced during page "building".

I did expect Azure RTOS, to have something similar.