MochiWeb is an Erlang web server that I’ve always been aware of but have never personally used, so I was interested in hearing people experiences of it.
I’ll be interested in reading comments too Louis!
I’d especially like to see QUIC/http3 support added. IIRC I think Peter said he wanted to add it to Ace but I haven’t seen him post anywhere for a while (is he still working on that Gleam framework? If so any idea which web server it uses? Ace?)
No, but html_sanitize_ex uses it as a dependency to parse html Really need to extract that so that not all of mochiweb needs to brought in simply for html parsing.
I used Webmachine for a while, which uses various bits of mochi. It was ok, but when Cowboy became available it left WM in the dust.
The older 0.x versions of Zotonic are running on MochiWeb with (modified) Webmachine.
Nowadays we are using Cowboy with Cowmachine, which is more performant.
Cowmachine [GitHub - zotonic/cowmachine: Webmachine for Zotonic and Cowboy] is a port and optimization of Webmachine to Cowboy, with similar callback functions.
Main differences with Basho’s Webmachine are:
- Use cowboy instead of mochiweb for the http server
- Separate dispatching (we use the dispatch compiler at [GitHub - zotonic/dispatch_compiler: Compiles dispatch rules to an Erlang module for quick dispatch matching.])
- Simplified callbacks
process/4callback for all http methods
- Caching of some callbacks (like
- More streaming options for returned data
- Better support for range requests
For HTML sanitization you can use the HTML sanitizer in the Zotonic stdlb [GitHub - zotonic/z_stdlib: Zotonic standard function library], check
z_html:sanitize/1, /2, and /4 functions.
The sanitizer comes from MochiWeb and is modified to better retain spaces.
It sounds like performance is one of the key reasons Cowboy is more commonly used than MochiWeb. Good to know.
Peter’s playing around with solar energy, type systems, and Gleam JS currently I believe. Very cool.
The core ideas of the Midas framework got merged into the
gleam_http library. He was also making a HTTP 1.1 server in Gleam but moved on to other things in the end.
Nice! I’m going to check that out this evening! Specifically neat it for sanitizing html created in markdown.