Skip to content

Commit

Permalink
ae.sys.net.cachedcurl: Include request headers in the cache key
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberShadow committed Feb 15, 2025
1 parent f0679b2 commit 0127f98
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sys/net/cachedcurl.d
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module ae.sys.net.cachedcurl;
// TODO: refactor into an abstract Cached!Network wrapper?

import std.algorithm.comparison;
import std.algorithm.iteration;
import std.conv;
import std.exception;
import std.file;
Expand Down Expand Up @@ -181,7 +182,7 @@ class CachedCurlNetwork : Network
/// Perform a raw request and return information about the resulting cached response.
Response cachedReq(ref const Request request)
{
auto hash = getDigestString!MD5(request.url.asBytes ~ cast(char)request.method ~ request.data);
auto hash = getDigestString!MD5(request.url.asBytes ~ cast(char)request.method ~ request.data ~ request.headers.map!(pair => pair[0].asBytes ~ pair[1].asBytes).join);
auto path = buildPath(cacheDir, hash[0..2], hash);
ensurePathExists(path);
auto metadataPath = path ~ ".metadata";
Expand Down

0 comments on commit 0127f98

Please sign in to comment.