std.net.curl: how to abort operation

mab via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 15 07:22:02 PDT 2017


I want to abort a download, if a condition inside of 
onReceiveHeader is true.
The following code do the job, but it feels very wrong - is there 
a better/proper way to do such a thing?

client.onReceiveHeader = (in char[] key, in char[] value) {
   if(key == "content-type") {
     if( -1 == value.indexOf("text" ,0, No.caseSensitive) ) {
       throw new ContentTypeException("No Text");
     }
   }
};




More information about the Digitalmars-d-learn mailing list