module safecurl;
void main() @safe
{
import std.net.curl;
import std.stdio: writeln;
char[] foo = get("http://dlang.org/");
writeln("length: ", foo.length);
}
safe-curl.d(8): Error: safe function 'D main' cannot call system function 'std.net.curl.get!(AutoProtocol, char).get'
The rest of std.net.curl is pretty much the same.. the whole module needs to be whacked by the @safe stick.
Comment #1 by bugzilla — 2019-12-17T08:53:18Z
It's more an enhancement request than a bug, isn't it?
Comment #2 by nick — 2024-06-14T20:20:04Z
Writing to a `void[]` cannot be @safe:
```d
string msg = "Hello world";
auto client = HTTP("dlang.org");
client.onSend = delegate size_t(void[] data)
{
auto m = cast(void[]) msg;
size_t length = m.length > data.length ? data.length : m.length;
if (length == 0) return 0;
data[0 .. length] = m[0 .. length];
msg = msg[length..$];
return length;
};
```
So that needs fixing in the API.
Comment #3 by robert.schadek — 2024-12-01T16:24:21Z