Recently the GNU project released the release of the new version of the library libmicrohttpd 0.9.74, A representing a simple API for built-in HTTP server functionality in applications.
Library supports HTTP 1.1 protocol, TLS, POST request incremental processing, basic and digest authentication, IPv6, SHOUTcast, and various methods for multiplexing connections (select, poll, pthread, thread pool), currently the implementation has support for various supported platforms, including GNU / Linux, FreeBSD, OpenBSD , NetBSD, Solaris, Android, macOS, Win32, Symbian, and z / OS.
GNU libmicrohttpd was born due to the need of its author, who at the time needed an easy way to add a concurrent HTTP server to other projects. The existing alternatives were non-free, non-reentrant, standalone, terrible code quality, or a combination thereof.
Of the characteristics that stand out to this implementation:
- Library C: fast and small
- The API is simple, expressive, and completely reentry.
- The implementation is HTTP 1.1 compliant
- HTTP server can listen on multiple ports
- Multiple Threading Modes: Run on Application Thread, Internal Thread, Thread Pool, and Thread Per Connection
- Three different socket polling modes: select (), poll (), and epoll
- Minimum number of system calls to avoid additional kernel / user mode changes
- Supported platforms include GNU / Linux, FreeBSD, OpenBSD, NetBSD, Android, Darwin (macOS), W32, OpenIndiana /
- Solaris and z / OS
- Support for IPv6
- SHOUTcast support
- Support for incremental processing of POST data (optional)
- Support for basic and implicit authentication (optional)
- TLS support (requires libgnutls, optional)
- The binary is only about 32k (without TLS support and other optional features)
Main new features of libmicrohttpd 0.9.74
In this new version that is presented from the library we can find that added an experimental implementation of the WebSockets protocol, which is not well tested yet and is disabled by default.
Another novelty that is presented is that compliance with the HTTP 1.0 / 1.1 protocol implementation specifications was improvedIn addition, the code was reworked to decode fragmented requests.
It is also highlighted that added code to automatically return errors related to bad chunked requests, too large data size and incorrect Content-Length header setting.
It has been realized internal optimizations, for example, improved memory management, improved hash efficiency, and elimination of repetitive parsing of the HTTP method and protocol version.
And it is also noted that it provided a stricter validation of the HTTP header values, allowed the use of a tab character in the response header values, but prohibited the use of spaces in the custom header values.
Besides that, the code to generate HTTP headers in response has been completely rewritten and the timeout precision has been increased from seconds to milliseconds.
Added build option –enable-sanitizers [= address, undefined, leak, user-poison] to selectively enable problem detection modes in code.
Fixed, clarified, expanded, and improved descriptions of Doxy features, now mentioning that it should be much easier to learn MHD just by reading the headings.
Of the other changes that stand out in this new version:
- Improved function descriptions in the microhttpd.h header file.
- API functions added MHD_get_reason_phrase_len_for () and MHD_create_response_from_buffer_with_free_callback_cls (), MHD_CONNECTION_INFO_HTTP_STATUS flag, MHD_get_connection_info (), as well as MHD_CONNECTION_INFO_HTTP_STATUS flag responses, and MHD_SDRIVE_HDRFKE_HDR_HDRF_HDR_HDRF_HDRF_REND_HDRF_HDRF_REND_HDRF_HDR_RF_RF_HDR_RF_HDRF_ responses.
- Added project file for assembly in MSVC.
- The response header formation was completely rewritten. The new implementation is more robust, easier to maintain and expandable, and better follows the RFC HTTP specifications.
- Performance improvements: Now HTTP version and request method are decoded only once (previously MHD used many string comparison
Finally if you are interested in knowing more about it about this release, you can consult the user manuals and other information on its website.