Added copyright and permission notice.
Factored out control functions into the http server file.