Support port of url and code refactor.

- Support port.
http(s)://your.domain:port/path/to/cal

- Reformat the code.