httpd: code cleanup and emable httpd to bind to any port