webfs: fix "fd out of range" error message

This commit is contained in:
cinap_lenrek 2016-05-04 18:53:31 +02:00
parent 4e665c8662
commit 66892eb133

View file

@ -122,14 +122,15 @@ hdial(Url *u)
snprint(addr, sizeof(addr), "tcp!%s!%s",
proxy->host, proxy->port ? proxy->port : proxy->scheme);
if((fd = dial(addr, 0, 0, &ctl)) >= 0){
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);
}
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);
}
if(fd < 0){
close(ctl);