NetBurner 3.5.6
PDF Version
HTML Form Post

NetBurner SSL HTML Form Post Example

Overview

This application demonstrates how to implement secure HTML form processing using SSL/TLS on NetBurner embedded devices. It extends the basic HTML form post functionality by adding SSL encryption for secure web communication.

Application Description

The HTML Form Post Example is a web-based application that runs on NetBurner devices and provides:

  • SSL/TLS encrypted web server functionality
  • Multiple HTML forms with POST data processing
  • Server-side form validation and data handling
  • Page redirection after form submission
  • Embedded SSL certificate and private key management

Key Features

Security

  • SSL/TLS Support: Uses HTTPS for encrypted communication
  • Embedded Certificates: Self-contained SSL certificate and private key
  • Secure Form Processing: All form data transmitted over encrypted connections

Web Interface

  • Multi-page Workflow: Three-page form processing sequence
  • Two Form Types: Different forms demonstrating various input handling
  • Dynamic Content: Server-side variable substitution in HTML pages
  • Error Handling: Form validation with error reporting

Form Processing

  • Form 1: Single text input field with simple processing
  • Form 2: Multiple variable input fields (Var0-Var3)
  • Callback System: Event-driven form processing with multiple callback points
  • Data Persistence: Form data maintained between page transitions

File Structure

\src
main.cpp # Main application entry point
web.cpp # Web server and form processing logic
ServerCert.cpp # Embedded SSL certificate data
ServerKey.cpp # Embedded SSL private key data
\html
index.html # First form page
page2.html # Second form page
complete.html # Completion/results page

Application Flow

  1. Initialization
    • Network stack initialization
    • HTTPS server startup (SSL-enabled)
    • DHCP network configuration
    • System diagnostics enablement
  2. Form Processing Workflow
    index.html > form1 POST > page2.html > form2 POST > complete.html
  3. Form Callbacks
    • eStartingPost: Initialize form processing
    • eVariable: Process each form variable
    • eFile: Handle file uploads (if present)
    • eEndOfPost: Complete processing and redirect

Technical Implementation

SSL Configuration

  • Uses embedded certificate and private key data
  • Certificate validity: 2019-2029
  • Elliptic Curve (EC) cryptography
  • Self-signed certificate for development/testing

Form Handlers

  • postForm1: Handles single text input from index.html
  • postForm2: Processes multiple variables from page2.html
  • URL Patterns: "form1*" and "form2*" for flexible routing

Data Storage

  • Form 1: Single 80-character text buffer
  • Form 2: Array of 4 variables, 80 characters each
  • Error Tracking: Boolean flags for form validation

HTML Integration

  • Dynamic Content: <!--CPPCALL FunctionName --> for server-side includes
  • WebTextForm1(): Displays Form 1 data
  • WebTextForm2(): Displays Form 2 data with formatting

Network Configuration

  • Protocol: HTTPS (SSL/TLS encrypted HTTP)
  • Port: Default HTTPS port (443)
  • Network: DHCP client configuration
  • Timeout: 5-second network initialization wait

Development Notes

Security Considerations

  • Uses development/test SSL certificate
  • Replace embedded certificate for production use
  • Certificate includes localhost and IP address subjects
  • Self-signed certificate will trigger browser warnings

Memory Usage

  • Fixed-size buffers for form data
  • Embedded certificate data: 672 bytes
  • Embedded private key data: 310 bytes
  • Form variables: configurable buffer sizes

Customization Points

  • Form variable names and counts
  • Buffer sizes for form data
  • SSL certificate replacement
  • HTML page content and styling

Building and Deployment

  1. Compile with NetBurner NNDK (NetBurner Network Development Kit)
  2. Flash to NetBurner device
  3. Configure network settings (DHCP or static IP)
  4. Access via HTTPS in web browser
  5. Accept security warning for self-signed certificate

Browser Compatibility

  • Supports all modern web browsers
  • Requires JavaScript disabled for basic functionality
  • HTML form POST method compatibility
  • SSL/TLS certificate acceptance required

Troubleshooting

Common Issues

  • Certificate Warnings: Expected with self-signed certificates
  • Network Connectivity: Verify DHCP configuration
  • Form Submission: Check POST URL patterns and handlers
  • SSL Handshake: Ensure certificate validity and browser compatibility

Debug Output

  • Console logging for all form processing events
  • Variable value tracking
  • Error condition reporting
  • Network initialization status

API Reference

Key Functions

Callback Events

  • eStartingPost: Form processing initialization
  • eVariable: Individual variable processing
  • eFile: File upload handling
  • eEndOfPost: Form completion processing