Re-fix pull req #245:

* Must declare port variable.

* Must look for https first, then http.