Fixed Mac support
Fixes and new functionality by Wouter Spruit, mostly for the HTTP proxy rewrite.
Such style. (Code style unification)
Fixed long forgotten merges.