[Issue 24458] Mac M3 associative array keys on std.net.curl gets overwritten

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 27 16:35:00 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24458

Steven Schveighoffer <schveiguy at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at gmail.com
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=2954

--- Comment #2 from Steven Schveighoffer <schveiguy at gmail.com> ---
Note that the root cause here is the use of `toLower` on the header key. Since
`toLower` will avoid allocating a new array if the input is already lower case,
the slice of the original curl buffer is returned (if e.g. it's `content-type`
instead of `Content-type`). This means you store a slice to a reusable buffer
from curl as the string key.

For the reason why this is allowed, when `const(char)[]` does not convert to
`string`, see issue 2954.

--


More information about the Digitalmars-d-bugs mailing list