Skip to content
straight-coding edited this page Nov 12, 2020 · 5 revisions

Welcome to the straight-httpd wiki!
This is a simple httpd prototype for embedded systems based on lwip and mbedtls (本项目是基于 lwip 和 mbedtls 开发的 http server 原型).
The goal of this project is to build a prototype system to simulate web services on an embedded system. The simulator has the following benefits (本项目的目标是搭建一个原型系统来模拟嵌入式系统上的 web 服务,利用该模拟器有如下好处):

  • The Windows platform is far more powerful than any MCU, and Microsoft Visual Studio has powerful debugging tools, so debugging will be much more efficient (Windows平台远比任何MCU强大,加上 Visual Studio 丰富的调试手段,让调试效率大大提高).
  • When working with a team, if only limited hardware or J-TAG emulators are available, some features that do not depend on the hardware can be developed simultaneously using this prototype (团队开发时,如果硬件环境不足、或J-TAG仿真器数量有限时,不依赖硬件环境的某些应用可以进行同步开发).
  • lwip and mbedtls have a lot of optional parameters, which need to be optimized for different embedded systems. To compare parameters, extensive experimentation is required, and this prototype can help speed up this process (lwipmbedtls 有非常多的可选参数,如何优化参数以适应不同的嵌入式系统,需要大量的比较实验,该模拟环境可以大大缩减实验周期).

Features

  • Support SSDP protocol: neighbours can detect this virtual device in the network.
  • Support HTTPS: all HTTP requests will be redirected to HTTPS (except SSDP XML). Both GET and POST are supported.
  • Support HTTP/1.1 pipelining and keep-alive. It is better for HTTPS to reuse connections because creating new connections is time consuming.
  • Support chunked response: Because the device memory is limited, generally it is not possible to wait for all the data to be ready before replying. When the device begins to return data, it does not know the total length. Transfer-Encoding: chunked allows you to split the data into chunks of various lengths, so that every chunk is within the device’s memory limit.
  • Support range request: Range: bytes=0- allows you to specify a single range. This feature is suitable for paged data, multi-threaded downloading or video fast forwarding.
  • Support request header If-Modified-Since for browsers to cache static files.
  • Support simple SSI (“Server Side Includes”) with simple syntax: <!--#TAG_NAME-->. Note that the syntax does not allow spaces between the "<" and ">". Every tag is a placeholder, which corresponds to a variable. The variable can be HTML content or the initial value of a javascript variable. When the device replies to a request, it will first convert the variable into a string. This string then replaces the corresponding tag. Based on the tag content, the js code can then complete HTML/DOM operations, such as select, checkbox, and radio control etc.
  • Demo pages include:
    • Sign in/out: verify user's username/password, if successful, redirect to "Home", otherwise stay in the login page, the session has 3 minutes timeout after login.
    • Home page: show some device information and the current status of the device.
    • Upload page: multiple files can be selected and queued to be uploaded to a specific device directory. The concurrency is 1, and every upload process can be terminated separately. Support large files.
    • Files page: you can browse all the files in the specified device directory, enter subdirectories or return to the parent directory. In addition, all files could be downloaded. Support large files.
    • Form page: demonstrates parameter modification and saving.
Clone this wiki locally