- if((fd = dial(addr, 0, 0, &ctl)) >= 0){
- if(proxy){
- if(strcmp(proxy->scheme, "https") == 0)
- fd = tlswrap(fd);
- } else {
- if(strcmp(u->scheme, "https") == 0)
- fd = tlswrap(fd);
- }
+ if((fd = dial(addr, 0, 0, &ctl)) < 0)
+ return nil;
+
+ if(proxy){
+ if(strcmp(proxy->scheme, "https") == 0)
+ fd = tlswrap(fd, proxy->host);
+ } else {
+ if(strcmp(u->scheme, "https") == 0)
+ fd = tlswrap(fd, u->host);