Updates cached data, ETag, and Last-Modified for the given URL */
| 435 | |
| 436 | /* Updates cached data, ETag, and Last-Modified for the given URL */ |
| 437 | static void UpdateCache(struct HttpRequest* req) { |
| 438 | cc_string url, altPath, value; |
| 439 | cc_string path; char pathBuffer[FILENAME_SIZE]; |
| 440 | cc_result res; |
| 441 | url = String_FromRawArray(req->url); |
| 442 | |
| 443 | value = String_FromRawArray(req->etag); |
| 444 | SetCachedTag(&url, &etagCache, &value, ETAGS_TXT); |
| 445 | value = String_FromRawArray(req->lastModified); |
| 446 | SetCachedTag(&url, &lastModCache, &value, LASTMOD_TXT); |
| 447 | |
| 448 | String_InitArray(path, pathBuffer); |
| 449 | altPath = String_Empty; |
| 450 | MakeCachePath(&path, &altPath, &url); |
| 451 | |
| 452 | res = Stream_WriteAllTo(&path, req->data, req->size); |
| 453 | if (res) { Logger_SysWarn2(res, "caching", &url); } |
| 454 | } |
| 455 | #else |
| 456 | static void TextureCache_Init(void) { |
| 457 | } |
no test coverage detected