How Web Log Autodetects the Server URL

As mentioned in Web Log, TortoiseCVS can in many cases automatically detect the URL used by your ViewCVS or CVSweb server. It does this by using the following algorithm:

  1. Start with the name of the CVS server, with a http:// prefix.

  2. Append one item from the list

    • /cgi-bin

    • /viewcvs

    • /cvsweb

    • /bin

    • (the empty string)

    and an item from the list

    • /viewcvs.cgi

    • /viewcvs

    • /cvsweb.cgi

    • /

    • /cvsweb

  3. Append the relative path for the file or folder (i.e. the value of 'Repository' shown in the CVS Properties dialog).

  4. Check if the computed URL works. If not, add ?cvsroot= followed by the name of the module and try again.

The above steps are done for each possible permutation of the different prefixes and suffixes. If a URL is found which returns HTTP status 200 (OK), the search stops. If no such URL is found, and an URL is found which returns HTTP status 401 (Denied) or 403 (Forbidden), that URL is used (based on the assumption that the user will be allowed access after authenticating to the web server).

Actually, there is also a little bit of magic done if the server name contains; SourceForge uses a non-standard mapping from CVSROOT/module to server name.