 		download(url) { (data, response, error) in
 
 			self.urlsBeingDownloaded.remove(faviconURL)
+			if response == nil || !response!.statusIsOK {
+				self.badURLs.insert(faviconURL)
+			}
+
 			if let data = data {
 				self.queue.async {
 					let _ = NSImage(data: data)


	func shouldDownloadFaviconURL(_ faviconURL: String) -> Bool {

		return !urlsBeingDownloaded.contains(faviconURL)
	}

	func downloadFavicon(_ faviconURL: String) {

		guard let url = URL(string: faviconURL) else {
			return

	private var faviconURLCache = ThreadSafeCache<String>() // homePageURL: faviconURL
	private let folder: String
	private var urlsBeingDownloaded = Set<String>()
	private var badURLs = Set<String>() // URLs that didn’t work for some reason; don’t try again
	private let binaryCache: RSBinaryCache
	private var badImages = Set<String>() // keys for images on disk that NSImage can’t handle
	private let queue: DispatchQueue
