db063154dcf9c02922ff4b94922d713c2bbb5f4c
chmalee
  Fri Feb 21 16:37:35 2020 -0800
Don't use udc to check for existence of hub description pages unless the file is a local file. The polytracts hub does not return a Content-Length header for the hub description page so even though it exists udcExists() doesn't find it, refs Lou email

diff --git src/hg/utils/hubCheck/hubCheck.c src/hg/utils/hubCheck/hubCheck.c
index 9bcb27e..9d3db63 100644
--- src/hg/utils/hubCheck/hubCheck.c
+++ src/hg/utils/hubCheck/hubCheck.c
@@ -831,31 +831,31 @@
                 struct trackHubCheckOptions *options, struct dyString *errors)
 /* Check out genome within hub. */
 {
 struct errCatch *errCatch = errCatchNew();
 struct trackDb *tdbList = NULL;
 int genomeErrorCount = 0;
 boolean openedGenome = FALSE;
 
 if (errCatchStart(errCatch))
     {
     if (genome->twoBitPath != NULL)
         {
         char *htmlPath = hashFindVal(genome->settingsHash, "htmlPath");
         if (htmlPath == NULL)
             warn("warning: missing htmlPath setting for assembly hub '%s'", genome->name);
-        else if (!udcExists(htmlPath))
+        else if ((!hasProtocol(htmlPath) && !udcExists(htmlPath)) || netUrlHead(htmlPath, NULL) < 0)
             warn("warning: htmlPath file does not exist: '%s'", htmlPath);
         }
     tdbList = trackHubTracksForGenome(hub, genome);
     tdbList = trackDbLinkUpGenerations(tdbList);
     tdbList = trackDbPolishAfterLinkup(tdbList, genome->name);
     trackHubPolishTrackNames(hub, tdbList);
     }
 errCatchEnd(errCatch);
 if (errCatch->gotError || errCatch->gotWarning)
     {
     openedGenome = TRUE;
     genomeErr(errors, errCatch->message->string, hub, genome, options->htmlOut);
     if (errCatch->gotError)
         genomeErrorCount += 1;
     }
@@ -907,33 +907,37 @@
 
 int trackHubCheck(char *hubUrl, struct trackHubCheckOptions *options, struct dyString *errors)
 /* Check a track data hub for integrity. Put errors in dyString.
  *      return 0 if hub has no errors, 1 otherwise
  *      if options->checkTracks is TRUE, check remote files of individual tracks
  */
 {
 struct errCatch *errCatch = errCatchNew();
 struct trackHub *hub = NULL;
 struct dyString *hubErrors = dyStringNew(0);
 int retVal = 0;
 
 if (errCatchStart(errCatch))
     {
     hub = trackHubOpen(hubUrl, "");
-    if (hub->descriptionUrl == NULL)
+    // servers that don't return Content-Length header aren't found by udcExists so
+    // use netUrlHead too. We still want udcExists so if a file is a local file we
+    // can still find it
+    char *descUrl = hub->descriptionUrl;
+    if (descUrl == NULL)
         warn("warning: missing hub overview descripton page (descriptionUrl setting)");
-    else if (!udcExists(hub->descriptionUrl))
+    else if ((!hasProtocol(descUrl) && !udcExists(descUrl)) || netUrlHead(descUrl, NULL) < 0)
         warn("warning: %s descriptionUrl setting does not exist", hub->descriptionUrl);
     }
 errCatchEnd(errCatch);
 if (errCatch->gotError || errCatch->gotWarning)
     {
     retVal = 1;
     hubErr(hubErrors, errCatch->message->string, hub, options->htmlOut);
 
     if (options->htmlOut)
         dyStringPrintf(errors, "trackData['#'] = [%s,",
             makeFolderObjectString(hub->shortLabel, "Hub Errors", "#",
                 "Click to open node", TRUE, TRUE));
     }
 errCatchFree(&errCatch);