Add CSP 1.1 support to CSP middleware

Add CSP 1.1. support to CSP middleware, plus numerous other minor fixes.