Second Round CURL Wrapper Review

Jonathan M Davis jmdavisProg at gmx.com
Sun Dec 11 17:04:27 PST 2011


On Sunday, December 11, 2011 19:55:28 dsimcha wrote:
> On 12/11/2011 7:53 PM, dsimcha wrote:
> > Should the protocol detection be case-insensitive, i.e. "ftp://" ==
> > "FTP://"?
> 
> Oh, one more thing:  Factor the protocol detection out into a function.
>   You have the same expression cut and pasted everywhere:
> 
> if(url.startsWith("ftp://") || url.startsWith("ftps://") ...

And startsWith will take multiple arguments, so the code definitely shouldn't 
have

x.startsWith(y) || x.startsWith(z) || ...

It's more verbose and less efficient that way.

- Jonathan M Davis


More information about the Digitalmars-d mailing list