Simple-Web-Server has turned out to be a perfect fit for A better Trader… more to come…

Update: add these awesome ones!

https://pocoproject.org/
https://macchina.io/docs/
http://vinniefalco.github.io/beast/beast/intro/example.html

Goal: find the fastest possible C++ https library that can score an A on the SSLLabs test. Ties broken by ease of use, then by support for websockets.

Initial results (see wiki for latest…):

LIBRARY ab

MB/sec

ab

pages/sec

SSL LABS
SCORE
EASE WS? COMMENTS
apache A 3 N need to write a module, apache remains in charge of message loop (unacceptable)
libwebsockets 7 Y
proxygen 7 only easy to build on ubuntu so hasn’t been stood up on my gentoo server yet; huge kitchen sink of helpers
Simple-Web-Server  B 10 Y websockets in a seperate compatible project; may be able to leverage asio to improve score (capped by RC4); no forward secrecy
websocketpp  uses asio, specifies a “modern” mode that only allows TSL1.2
mongoose 3 messy ton of hand-crafted portability C code scared me off
onion looks like a strong C lib
libmicrohttpd GNU c lib, not sure it supports modern algos, check score…

I use my rad-scripts node module to quickly set up management and automation of my active projects.  I now have a couple private node modules:

  • mah-haus is my node module that mass-manages all my repos – it’s great; with one command I can completely sync my entire dev station when I start/finish a session
  • atci is for my AbetterTrader project and gives me all the dev tools I need to build, publish, and run continuous integration

Thanks node.js, I love my new automated life.  Should I publish these modules even though they have no real public use?  Nah, why pollute the npm-isphere?  But I will put this post here so I can use it for the module home pages.  😉  Carry on!

I gave myself an hour to add multi-line search-and-replace support in my code.  It took 3, and C++11 std::regex_replace() gave me a hard crash with inline replacement.  The syntax can be annoying (for example, using double escape), so for reference, here’s a jumpstart.

Given:

using namespace std;
string str = "Lots of text to search\nacross lines";
string from = "text[\\s\\S]*lines";
string to = "rainbows";

Boost happily did the job:

#include 
 boost::regex reg;
 reg.assign(from);
 str = boost::regex_replace(str,reg,to,boost::match_default);

C++11 is even simpler, but it crashes with gcc 4.9.2 if you use the same string for source and target, like this:

#include 
 std::regex reg(from);
 str = std::regex_replace(str,reg,to);

You can fix that by using a swap string:

#include 
 regex reg(from);
 string newstr = regex_replace(str,reg,to);
 str = newstr;

But it isn’t working across lines, with this particular syntax, and I’ve seen others complain that they couldn’t get multiline syntax going.  I’ll stick with boost for now until this smooths out a little bit more.  Onwards.

 

I pushed my http[s] RESTy client and server to github yesterday.  It’s almost there.  Today, working on favicon.ico support.  Cmon!

Persistent notes will go on the wiki.