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 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.
Visual Studio started CLOSING on me as I was editing due to my apparent change in status at some far-flung location for which I have no control. If Microsoft thinks that’s a feature I want in my primary development tool… well, all I have to say is, never again will I rely on it. Eclipse is a decent IDE and I’ll be converting my muscle memory to its ways after a couple decades of baking Visual Studio into my hands. It may be painful but it is also long overdue.
- Install Eclipse
- I went for the PHP version (“PDT”) since it seemed to have a few bells and whistles (eg git)
- The C++ support in Eclipse is called “CDT” and you can install it by adding this “Work with” repo:
http://download.eclipse.org/tools/cdt/releases/kepler
- I installed “CDT Main Features”, plus optional Memory View Enhancements, Misc Utils, Multicore Visualizer, Qt support, (ironically) Visual C++ support, and Visualizer Framework. Not sure about these, time will tell.
- Configure Eclipse
- The biggest startup challenge is setting up key shortcuts. The default ones are pretty stupid if you’ve used Microsoft products. The main thing to remember is that you have to search for existing shortcut keys and manually remove them before you can add a new one, otherwise you will just get conflicts and nothing will work. This sucks shit but not too bad once you realize what is going on.
- Set UTF-8 encoding:
Windows > Preferences > General > Content Types, set UTF-8 as the default encoding for all content types. Windows > Preferences > General > Workspace, set "Text file encoding" to "Other : UTF-8".
- Set up projects
- Open C++ perspective
- Right-click project pane, New…, Blank Makefile, Other toolchain, use existing codebase location for workspace
- Search…, Working set, Choose, New, Resource, Name = codebase, click on existing codebase location, OK
More to come as I work with it. I’m moving the notes to the wiki.