From a3a4eb23dbcc7ec1e8aa701a083f43983a6e59f6 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Fri, 27 Dec 2019 08:22:44 +1100 Subject: [PATCH] Don't forget to check return code of HttpCache_Lookup --- src/Http.c | 5 +++-- src/Http.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Http.c b/src/Http.c index 121652eb4..bba0951c8 100644 --- a/src/Http.c +++ b/src/Http.c @@ -351,7 +351,7 @@ static void Http_DownloadNextAsync(void) { struct HttpRequest req; if (http_terminate || !pendingReqs.count) return; /* already working on a request currently */ - if (http_curRequest.ID[0] != '\0') return; + if (http_curRequest.id[0]) return; req = pendingReqs.entries[0]; RequestList_RemoveAt(&pendingReqs, 0); @@ -560,12 +560,13 @@ static cc_result Http_StartRequest(struct HttpRequest* req, String* url, HINTERN static const char* verbs[3] = { "GET", "HEAD", "POST" }; struct HttpCacheEntry entry; String path; char pathBuffer[URL_MAX_SIZE + 1]; + cc_result res; DWORD flags; HttpCache_MakeEntry(url, &entry, &path); Mem_Copy(pathBuffer, path.buffer, path.length); pathBuffer[path.length] = '\0'; - HttpCache_Lookup(&entry); + if ((res = HttpCache_Lookup(&entry))) return res; flags = INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_NO_UI | INTERNET_FLAG_RELOAD | INTERNET_FLAG_NO_COOKIES; if (entry.Https) flags |= INTERNET_FLAG_SECURE; diff --git a/src/Http.h b/src/Http.h index 9741b8269..e40e046fb 100644 --- a/src/Http.h +++ b/src/Http.h @@ -29,7 +29,7 @@ struct HttpRequest { cc_result result; /* 0 on success, otherwise platform-specific error. */ cc_uint8* data; /* Contents of the response. (i.e. result data) */ - cc_uint32 size; /* Size of the contents. (may still be non-zero for non 200 status codes) */ + cc_uint32 size; /* Size of the contents. */ char lastModified[STRING_SIZE]; /* Time item cached at (if at all) */ char etag[STRING_SIZE]; /* ETag of cached item (if any) */