090d4afcaf0482dfa3f5eaec25d915f1d4a9fa9e
max
  Thu Jun 15 13:34:32 2017 -0700
Cleanup of hgSession to make the distinction between the login server and local
server clearer in the code. Renaming and moving two functions from wikiLink to
hdb, as at least one is not necessarily wikiLink-related and it's good to keep
them together. Also adding a warning to hgSession.c (probably
useless). refs #19632 and also see related tickets there.

diff --git src/hg/inc/hdb.h src/hg/inc/hdb.h
index 0a8564d..86266e7 100644
--- src/hg/inc/hdb.h
+++ src/hg/inc/hdb.h
@@ -439,33 +439,62 @@
  * The list includes the name, description, and where to
  * find the nib-formatted DNA files. Free this with dbDbFree. */
 
 struct hash *hDbDbHash();
 /* The hashed-up version of the entire dbDb table, keyed on the db */
 
 int hDbDbCmpOrderKey(const void *va, const void *vb);
 /* Compare to sort based on order key */
 
 char *hDbDbNibPath(char *database);
 /* return nibPath from dbDb for database */
 
 char *hHttpHost();
 /* return http host from apache or hostname if run from command line  */
 
+char *hLocalHostCgiBinUrl();
+/* Return the current full absolute URL of the cgi-bin directory of the local
+ * server in the format http(s)://<host>/<cgiBinDir>, e.g.
+ * https://genome.ucsc.edu/cgi-bin/.
+ * The <host> is coming from the SERVER_NAME variable, which is
+ * the ServerName setting in the Apache config file.
+ * The cgi-bin directory is coming from the SCRIPT_NAME variable, the relative
+ * location of the cgi program relative to Apache's DOCUMENT_ROOT.
+ * Https is used if the variable HTTPS is set by Apache.
+ *
+ * If login.relativeLink=on is set, return only the empty string. 
+ * (This is used on the CIRM server, as it has no way of knowing what its
+ * actual server name is, it is behind a reverse proxy)
+ * Result has to be free'd. */
+
+char *hLoginHostCgiBinUrl();
+/* Return the current full absolute URL of the cgi-bin directory of the host
+ * used for logins. Genome-euro/genome-asia use genome.ucsc.edu for the login,
+ * as we have only one single server for user accounts.
+ * Returns a string in the format
+ * http(s)://<host>/cgi-bin/ e.g. http://genome.ucsc.edu/cgi-bin/
+ * - the <host> is coming from the wiki.host variable in hg.conf.
+ * - https is used unless login.useHttps=off in hg.conf
+ *
+ * If login.relativeLink=on is set, return only the empty string. 
+ * (see hLocalCgiBinUrl)
+ * Result has to be free'd. */
+
 boolean hHostHasPrefix(char *prefix);
 /* Return TRUE if this is running on web-server with host name prefix */
 
+
 boolean hIsPrivateHost(void);
 /* Return TRUE if this is running on private (development) web-server.
  * This was originally genome-test as well as hgwdev, however genome-test
  * may be repurposed to direct users to the preview site instead of development site. */
 
 boolean hIsBetaHost(void);
 /* Return TRUE if this is running on beta (QA) web-server.
  * Use sparingly as behavior on beta should be as close to RR as possible. */
 
 boolean hIsBrowserbox();
 /* Return TRUE if this is the browserbox virtual machine */
 
 boolean hIsGbic();
 /* Return TRUE if this mirror has been installed by the installation script */