Просмотр исходного кода

Fix: osl-registry cached download/ETag state mismatch

After upgrading an existing client to the new streaming
OSL download code, it was possible for the last downloaded
ETag to be the latest version, but for no cached download
file to be on disk.
Rod Hynes 8 лет назад
Родитель
Сommit
314ccffcca
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      psiphon/remoteServerList.go

+ 7 - 0
psiphon/remoteServerList.go

@@ -134,6 +134,13 @@ func FetchObfuscatedServerLists(
 	downloadURL := osl.GetOSLRegistryURL(rootURL)
 	canonicalURL := osl.GetOSLRegistryURL(canonicalRootURL)
 
+	// If the cached registry is not present, we need to download or resume downloading
+	// the registry, so clear the ETag to ensure that always happens.
+	_, err := os.Stat(cachedFilename)
+	if os.IsNotExist(err) {
+		SetUrlETag(canonicalURL, "")
+	}
+
 	// failed is set if any operation fails and should trigger a retry. When the OSL registry
 	// fails to download, any cached registry is used instead; when any single OSL fails
 	// to download, the overall operation proceeds. So this flag records whether to report