Skip to content

Commit 8e76f07

Browse files
authored
Merge pull request #8961 from MrcSnm/patch-1
Fix Bugzilla Issue 24458 - Mac M3 associative array keys on std.net.curl gets overwritten
2 parents a2ade9d + 4d332ba commit 8e76f07

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

std/net/curl.d

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2422,6 +2422,7 @@ struct HTTP
24222422
import std.algorithm.searching : findSplit, startsWith;
24232423
import std.string : indexOf, chomp;
24242424
import std.uni : toLower;
2425+
import std.exception : assumeUnique;
24252426

24262427
// Wrap incoming callback in order to separate http status line from
24272428
// http headers. On redirected requests there may be several such
@@ -2448,7 +2449,9 @@ struct HTTP
24482449
}
24492450

24502451
auto m = header.findSplit(": ");
2451-
auto fieldName = m[0].toLower();
2452+
const(char)[] lowerFieldName = m[0].toLower();
2453+
///Fixes https://issues.dlang.org/show_bug.cgi?id=24458
2454+
string fieldName = lowerFieldName is m[0] ? lowerFieldName.idup : assumeUnique(lowerFieldName);
24522455
auto fieldContent = m[2].chomp;
24532456
if (fieldName == "content-type")
24542457
{

0 commit comments

Comments
 (0)