Re-fix pull req #245:

* Must declare port variable.

* Must look for https first, then http.
Merge pull request #252 from astrand/port-80-443

Re-fix pull req #245: