[urgent] Fix possible stack corruption in std.net.curl

The HTTP and SMTP structs are used as value types. The delegate created in onReceiveHeader stores a pointer to this HTTP as it needs to access this.p so we potentially leak a reference to a stack variable here.

As the Impl struct is always allocated on the heap via RefCounted storing a pointer to Impl is not an issue. So we move the delegate generation out of HTTP and into impl to make sure it only stores a pointer to Impl which will stay valid even if the original HTTP object is moved.

Also reset some delegates in _basicHTTP and _basicFTP to avoid leaving references to stack variables around.


Here's an example how to break it as long as this fix isn't applied: http://dpaste.dzfl.pl/c109c2fd