NetBurner 3.5.8
PDF Version
HTML Form Post

Example Path: examples/SSL/HtmlFormPost

SSL/TLS HTML Form Post

Overview

This example handles HTML form submissions on a NetBurner device over an encrypted HTTPS connection. It walks through a two-form, three-page workflow and echoes the collected values back on a completion page.

It is the secure counterpart of the standard examples/Web/HtmlFormPost example – the only functional difference is that the web server is started with StartHttps() and the device serves the pages with an embedded TLS certificate and private key.

Note
The bundled certificate is self-signed, so browsers display a warning unless you install the matching Certificate Authority. Choose the option to "continue anyway" to proceed.

How It Works

  1. UserMain() initializes the network stack and starts the HTTPS server with StartHttps().
  2. index.html presents the first form, which POSTs to form1. The form1PostCallBack() handler stores the single text field, then issues a RedirectResponse() to page2.html.
  3. page2.html presents the second form (Var0-Var3), which POSTs to form2. The form2PostCallBack() handler stores each variable, then redirects to complete.html.
  4. complete.html displays the submitted values via the <!--CPPCALL WebTextForm1 --> and <!--CPPCALL WebTextForm2 --> tags, which are filled in by WebTextForm1() / WebTextForm2() as the page is served.

The post handlers are registered against wildcard URL patterns so any URL starting with form1 / form2 is routed to the matching callback:

HtmlPostVariableListCallback postForm1("form1*", form1PostCallBack);
HtmlPostVariableListCallback postForm2("form2*", form2PostCallBack);

Files

  • main.cpp – entry point; initializes the network stack and starts the HTTPS server.
  • web.cpp – the two POST callbacks and the WebTextForm1 / WebTextForm2 CPPCALL handlers.
  • index.html / page2.html / complete.html – the three workflow pages.
  • style.css – self-contained stylesheet (plain CSS, no framework or CDN).
  • logo.png – header logo.
  • ServerCert.cpp / ServerKey.cpp – embedded TLS certificate and key.

POST Callback Events

Each callback is invoked with a sequence of events:

  • eStartingPost – clear the stored variables before new data arrives.
  • eVariable – called once per form field; copy the value into a buffer.
  • eFile – a file upload field (unused in this example).
  • eEndOfPost – all fields received; RedirectResponse() to the next page.

Notes

  • Form data is held in fixed 80-character buffers; longer values are truncated by strncpy.
  • EnableSystemDiagnostics() is enabled for development and would typically be removed for production.

Related Examples

  • examples/Web/HtmlFormPost – the same example without SSL/TLS.