Enhancements for cplusplus based protocol handlers.

I think these would be useful for everyone.
I made these changes to enable cpp to be used as a protocol handler.
I have some cpp classes that I'll look at sharing once they are more fleshed out, if your interested.
No you don't have to create a new pull request. Simply commit the changes and push them to the same branch (In this case your `master`).