[Issue 13573] New: std.net.curl doesn't handle exceptions in callbacks
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Oct 4 01:05:45 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13573
Issue ID: 13573
Summary: std.net.curl doesn't handle exceptions in callbacks
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
Assignee: nobody at puremagic.com
Reporter: code at dawg.eu
cat > bug.d << CODE
import std.net.curl;
void main()
{
auto http = HTTP("dlang.org/non-existing-url");
http.onReceiveStatusLine = (HTTP.StatusLine s) {
if (s.code != 200)
throw new Exception("Request failed.");
};
http.method = HTTP.Method.head;
http.perform();
}
CODE
dmd -L-lcurl -run bug
----
This program segfaults because the D exception handling cannot unwind through
the C stack of libcurl. What's needed here is either a nothrow requirement on
the callbacks or an exception catch/rethrow mechanism.
--
More information about the Digitalmars-d-bugs
mailing list