Don't forget to check return code of HttpCache_Lookup

This commit is contained in:
UnknownShadow200 2019-12-27 08:22:44 +11:00
parent 5fb2656d03
commit a3a4eb23db
2 changed files with 4 additions and 3 deletions

View File

@ -351,7 +351,7 @@ static void Http_DownloadNextAsync(void) {
struct HttpRequest req; struct HttpRequest req;
if (http_terminate || !pendingReqs.count) return; if (http_terminate || !pendingReqs.count) return;
/* already working on a request currently */ /* already working on a request currently */
if (http_curRequest.ID[0] != '\0') return; if (http_curRequest.id[0]) return;
req = pendingReqs.entries[0]; req = pendingReqs.entries[0];
RequestList_RemoveAt(&pendingReqs, 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" }; static const char* verbs[3] = { "GET", "HEAD", "POST" };
struct HttpCacheEntry entry; struct HttpCacheEntry entry;
String path; char pathBuffer[URL_MAX_SIZE + 1]; String path; char pathBuffer[URL_MAX_SIZE + 1];
cc_result res;
DWORD flags; DWORD flags;
HttpCache_MakeEntry(url, &entry, &path); HttpCache_MakeEntry(url, &entry, &path);
Mem_Copy(pathBuffer, path.buffer, path.length); Mem_Copy(pathBuffer, path.buffer, path.length);
pathBuffer[path.length] = '\0'; 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; flags = INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_NO_UI | INTERNET_FLAG_RELOAD | INTERNET_FLAG_NO_COOKIES;
if (entry.Https) flags |= INTERNET_FLAG_SECURE; if (entry.Https) flags |= INTERNET_FLAG_SECURE;

View File

@ -29,7 +29,7 @@ struct HttpRequest {
cc_result result; /* 0 on success, otherwise platform-specific error. */ cc_result result; /* 0 on success, otherwise platform-specific error. */
cc_uint8* data; /* Contents of the response. (i.e. result data) */ 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 lastModified[STRING_SIZE]; /* Time item cached at (if at all) */
char etag[STRING_SIZE]; /* ETag of cached item (if any) */ char etag[STRING_SIZE]; /* ETag of cached item (if any) */