ref: f54501c2592bd7cee283a243391d07f2dd131373
dir: /9legacy/webfs_SNI.diff/
diff -Pur sys/src/cmd/webfs/fns.h /sys/src/cmd/webfs/fns.h --- /n/dump/2021/0627//sys/src/cmd/webfs/fns.h Sun Sep 22 04:39:47 2002 +++ /sys/src/cmd/webfs/fns.h Wed Jul 14 11:24:55 2021 @@ -34,7 +34,7 @@ void httpclose(Client*); /* io.c */ -int iotlsdial(Ioproc*, char*, char*, char*, int*, int); +int iotlsdial(Ioproc*, char*, char*, char*, char*, int*, int); int ioprint(Ioproc*, int, char*, ...); #pragma varargck argpos ioprint 3 diff -Pur sys/src/cmd/webfs/http.c /sys/src/cmd/webfs/http.c --- /n/dump/2021/0627//sys/src/cmd/webfs/http.c Thu Jul 15 20:47:20 2010 +++ /sys/src/cmd/webfs/http.c Wed Jul 14 11:24:21 2021 @@ -286,7 +286,7 @@ fprint(2, "dial %s\n", hs->netaddr); fprint(2, "dial port: %s\n", url->port); } - fd = iotlsdial(io, hs->netaddr, 0, 0, 0, url->ischeme==UShttps); + fd = iotlsdial(io, hs->netaddr, url->host, 0, 0, 0, url->ischeme==UShttps); if(fd < 0){ Error: if(httpdebug) diff -Pur sys/src/cmd/webfs/io.c /sys/src/cmd/webfs/io.c --- /n/dump/2021/0627//sys/src/cmd/webfs/io.c Thu Jan 15 19:54:27 2009 +++ /sys/src/cmd/webfs/io.c Wed Jul 14 11:35:35 2021 @@ -45,11 +45,12 @@ static long _iotlsdial(va_list *arg) { - char *addr, *local, *dir; + char *addr, *host,*local, *dir; int *cfdp, fd, tfd, usetls; TLSconn conn; addr = va_arg(*arg, char*); + host = va_arg(*arg, char*); local = va_arg(*arg, char*); dir = va_arg(*arg, char*); cfdp = va_arg(*arg, int*); @@ -64,6 +65,7 @@ memset(&conn, 0, sizeof conn); /* does no good, so far anyway */ // conn.chain = readcertchain("/sys/lib/ssl/vsignss.pem"); + conn.serverName = host; tfd = tlsClient(fd, &conn); close(fd); @@ -78,7 +80,7 @@ } int -iotlsdial(Ioproc *io, char *addr, char *local, char *dir, int *cfdp, int usetls) +iotlsdial(Ioproc *io, char *addr, char *host, char *local, char *dir, int *cfdp, int usetls) { - return iocall(io, _iotlsdial, addr, local, dir, cfdp, usetls); + return iocall(io, _iotlsdial, addr, host, local, dir, cfdp, usetls); }