Bug 14445 – std.net.curl not usable in @safe code

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-04-14T00:30:51Z
Last change time
2024-12-01T16:24:21Z
Keywords
safe
Assigned to
No Owner
Creator
Brad Roberts
Blocks
18110
Moved to GitHub: phobos#10126 →

Comments

Comment #0 by braddr — 2015-04-14T00:30:51Z
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
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10126 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB