Added dynamic URI detection.  Will also detect SSL and port if non-standard ports are used.