about summary refs log tree commit diff stats
path: root/src/io
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-07-14 00:06:00 +0200
committerbptato <nincsnevem662@gmail.com>2022-07-14 00:06:00 +0200
commitbb7a5ddcc44d8aab63d6463ce1cb72490e03c3e1 (patch)
tree246497c6745789c59ad2249c16e82fe15d3b64a5 /src/io
parent8ab202fa89941e9f528858b2e9e35cf39ad7043f (diff)
downloadchawan-bb7a5ddcc44d8aab63d6463ce1cb72490e03c3e1.tar.gz
getPageCurl: avoid loading pages that couldn't be loaded
Diffstat (limited to 'src/io')
-rw-r--r--src/io/loader.nim4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/io/loader.nim b/src/io/loader.nim
index 8d942ae2..bdd6aae6 100644
--- a/src/io/loader.nim
+++ b/src/io/loader.nim
@@ -156,6 +156,10 @@ proc getPageCurl(loader: FileLoader, url: Url, smethod: HttpMethod = HttpGet, mi
   else:
     result.contenttype = guessContentType(url.path.serialize())
 
+  if curl_proc.peekExitCode() > 0:
+    result.contenttype = ""
+    result.s = nil
+
 proc getPage*(loader: FileLoader, url: Url, smethod: HttpMethod = HttpGet, mimetype = "", body: string = "", multipart: MultipartData = nil): LoadResult =
   if url.scheme == "file":
     when defined(windows) or defined(OS2) or defined(DOS):