11c1c560b88d430fd2c6967a86d2e87109806357
max
  Fri Jan 24 09:15:03 2014 -0800
corrections after code review refs #12524. These changes probably don'tneed to reviewed anymore, as Angie has already seen them, I copied them into
the ticket #12524.

diff --git src/lib/udc.c src/lib/udc.c
index b9914dd..b32a94c 100644
--- src/lib/udc.c
+++ src/lib/udc.c
@@ -1619,47 +1619,62 @@
 time_t udcUpdateTime(struct udcFile *udc)
 /* return udc->updateTime */
 {
 if (sameString("transparent", udc->protocol))
     {
     struct stat status;
     int ret = stat(udc->url, &status);
     if (ret < 0)
 	return 0;
     else
 	return  status.st_mtime;
     }
 return udc->updateTime;
 }
 
-#ifdef PROGRESS_METER
-off_t remoteFileSize(char *url)
-/* fetch remote file size from given URL */
+off_t udcFileSize(char *url)
+/* fetch file size from given URL or local path 
+ * returns -1 if not found. */
 {
-off_t answer = 0;
+if (udcIsLocal(url))
+    return fileSize(url);
+
+// don't go to the network if we can avoid it
+int cacheSize = udcSizeFromCache(url, NULL);
+if (cacheSize!=-1)
+    return cacheSize;
+
+off_t ret = -1;
 struct udcRemoteFileInfo info;
 
 if (startsWith("http://",url) || startsWith("https://",url))
     {
     if (udcInfoViaHttp(url, &info))
-	answer = info.size;
+	ret = info.size;
     }
 else if (startsWith("ftp://",url))
     {
     if (udcInfoViaFtp(url, &info))
-	answer = info.size;
+	ret = info.size;
     }
+else
+    errAbort("udc/udcFileSize: invalid protocol for url %s, can only do http/https/ftp", url);
 
-return answer;
+return ret;
 }
-#endif
 
 boolean udcIsLocal(char *url) 
 /* return true if file is not a http or ftp file, just a local file */
 {
 // copied from above
 char *protocol = NULL, *afterProtocol = NULL, *colon;
 udcParseUrl(url, &protocol, &afterProtocol, &colon);
 freez(&protocol);
 freez(&afterProtocol);
 return colon==NULL;
 }
+
+boolean udcExists(char *url)
+/* return true if a local or remote file exists */
+{
+return udcFileSize(url)!=-1;
+}