Access origin

This will also refactor the plugin related tasks to its own class.
Also, it fixes a bug when parsing the minor version header.
Can we move ``$_SERVER['HTTP_REFERER']`` to the ``$request['__application']`` -- so the plugins won't need to call PHP globals themself?