Ok, there are now two commits https://github.com/wuzzeb/snap-server/commit/71128574d812338c07e146d9b5c1bdfc9a5098d2 https://github.com/wuzzeb/snap-server/commit/0af59d65177889b522e015fbf9adb4db68d7c723
The first commit changes the backend API, updates the simple backend, and adds ssl support using gnutls. In this commit, the ev backend is temporarily broken. In the second commit, I update the ev backend. Comparing the benchmarks I get the speed within the standard deviation so the changes don't really impact the speed. Although more tests would be nice. ----------------------- I looked at trying to use a class per backend with SPECIALIZE macros, but from the ghc docs it looks like the SPECIALIZE macro won't work. So what I instead did is to move part of httpServe into the backend. The way the existing httpServe works is to call Backend.new and then call withConnection. What I did is instead of passing the callback function to withConnection, httpServe now passes the callback function during backend creation. This means we never access the backend from Server.hs so don't need a class. You can see the API definition in Internal/Http/Server/Backend.hs Also, I started to abstract the read/write between http and https using a class, but again couldn't figure out how to get the SPECIALIZE macros to work. So instead ListenHelpers.hs dispatches between the two. The functions in ListenHelpers will be inlined so it makes it fast. TODO ---------------------- + Update the configuration class and simpleHttpServe to pass the ssl options. It supports listening on more than one port, I don't know how we want to stick that in the configuration. Do we want to make an API change and change address and port to a list of tuples? + The test suite currently uses the default backend. Since we now support both backends at the same time, the test suite should be updated to run the tests twice, once with each backend. + Update some of the tests in the test suite to run both http and https. John _______________________________________________ Snap mailing list [email protected] http://mailman-mail5.webfaction.com/listinfo/snap
