b61d135abcd656964b1c9fedb938d0f47a44357f galt Wed Apr 17 16:06:06 2013 -0700 adding support for HTTPS by not hardwiring the protocol and port in the URL but detecting when https is in use diff --git src/hg/hgSession/hgSession.c src/hg/hgSession/hgSession.c index 6986ad1..ac7647f 100644 --- src/hg/hgSession/hgSession.c +++ src/hg/hgSession/hgSession.c @@ -149,39 +149,47 @@ char path[512]; char buf[512]; char *ptr = NULL; safef(path, sizeof(path), "%s", cgiScriptName()); ptr = strrchr(path, '/'); if (ptr == NULL) path[0] = '\0'; else *(ptr+1) = '\0'; safef(buf, sizeof(buf), "%s%s", path, "hgTracks"); thePath = cloneString(buf); } return thePath; } +char *appendSForHttps() +/* if running on https, add the letter s to the url protocol */ +{ +if (cgiServerHttpsIsOn()) + return "s"; +return ""; +} + void addSessionLink(struct dyString *dy, char *userName, char *sessionName, boolean encode) /* Add to dy an URL that tells hgSession to load a saved session. * If encode, cgiEncodeFull the URL. */ { struct dyString *dyTmp = dyStringNew(1024); -dyStringPrintf(dyTmp, "http://%s%s?hgS_doOtherUser=submit&" +dyStringPrintf(dyTmp, "http%s://%s%s?hgS_doOtherUser=submit&" "hgS_otherUserName=%s&hgS_otherUserSessionName=%s", - cgiServerNamePort(), destAppScriptName(), userName, sessionName); + appendSForHttps(), cgiServerNamePort(), destAppScriptName(), userName, sessionName); if (encode) { dyStringPrintf(dy, "%s", cgiEncodeFull(dyTmp->string)); } else { dyStringPrintf(dy, "%s", dyTmp->string); } dyStringFree(&dyTmp); } char *getSessionLink(char *encUserName, char *encSessionName) /* Form a link that will take the user to a bookmarkable page that * will load the given session. */ { @@ -200,32 +208,32 @@ dyStringPrintf(dy, "Email\n"); return dyStringCannibalize(&dy); } void addUrlLink(struct dyString *dy, char *url, boolean encode) /* Add to dy an URL that tells hgSession to load settings from the given url. * If encode, cgiEncodeFull the whole thing. */ { struct dyString *dyTmp = dyStringNew(1024); char *encodedUrl = cgiEncodeFull(url); -dyStringPrintf(dyTmp, "http://%s%s?hgS_doLoadUrl=submit&hgS_loadUrlName=%s", - cgiServerNamePort(), destAppScriptName(), encodedUrl); +dyStringPrintf(dyTmp, "http%s://%s%s?hgS_doLoadUrl=submit&hgS_loadUrlName=%s", + appendSForHttps(), cgiServerNamePort(), destAppScriptName(), encodedUrl); if (encode) { dyStringPrintf(dy, "%s", cgiEncodeFull(dyTmp->string)); } else { dyStringPrintf(dy, "%s", dyTmp->string); } freeMem(encodedUrl); dyStringFree(&dyTmp); } char *getUrlLink(char *url) /* Form a link that will take the user to a bookmarkable page that * will load the given url. */ @@ -504,31 +512,31 @@ printf("