--- /n/sources/plan9/sys/src/cmd/webfs/io.c Fri Jan 16 06:00:04 2009 +++ /sys/src/cmd/webfs/io.c Fri Jun 19 00:00:00 2026 @@ -45,11 +45,12 @@ ioprint(Ioproc *io, int fd, char *fmt, ...) static long _iotlsdial(va_list *arg) { - char *addr, *local, *dir; + char *addr, *server, *local, *dir; int *cfdp, fd, tfd, usetls; TLSconn conn; addr = va_arg(*arg, char*); + server = va_arg(*arg, char*); local = va_arg(*arg, char*); dir = va_arg(*arg, char*); cfdp = va_arg(*arg, int*); @@ -62,6 +63,7 @@ _iotlsdial(va_list *arg) return fd; memset(&conn, 0, sizeof conn); + conn.serverName = server; /* does no good, so far anyway */ // conn.chain = readcertchain("/sys/lib/ssl/vsignss.pem"); @@ -78,7 +80,7 @@ _iotlsdial(va_list *arg) } int -iotlsdial(Ioproc *io, char *addr, char *local, char *dir, int *cfdp, int usetls) +iotlsdial(Ioproc *io, char *addr, char *server, char *local, char *dir, int *cfdp, int usetls) { - return iocall(io, _iotlsdial, addr, local, dir, cfdp, usetls); + return iocall(io, _iotlsdial, addr, server, local, dir, cfdp, usetls); } --- /n/sources/plan9/sys/src/cmd/webfs/fns.h Thu Sep 26 23:01:17 2002 +++ /sys/src/cmd/webfs/fns.h Fri Jun 19 00:00:00 2026 @@ -34,7 +34,7 @@ int httpread(Client*, Req*); 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 --- /n/sources/plan9/sys/src/cmd/webfs/http.c Fri Jul 16 11:00:06 2010 +++ /sys/src/cmd/webfs/http.c Fri Jun 19 00:00:00 2026 @@ -286,7 +286,7 @@ httpopen(Client *c, Url *url) 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) @@ -312,6 +312,8 @@ httpopen(Client *c, Url *url) fprint(2, "<- User-Agent: %s\n", c->ctl.useragent); if(c->ctl.useragent) ioprint(io, fd, "User-Agent: %s\r\n", c->ctl.useragent); + if(c->hdr) + ioprint(io, fd, "%s", c->hdr); if(c->ctl.sendcookies){ /* should we use url->page here? sometimes it is nil. */ cookies = httpcookies(url->host, url->http.page_spec, @@ -323,10 +325,12 @@ httpopen(Client *c, Url *url) free(cookies); } if(c->havepostbody){ - ioprint(io, fd, "Content-type: %s\r\n", PostContentType); + if(c->hdr == nil) + ioprint(io, fd, "Content-type: %s\r\n", PostContentType); ioprint(io, fd, "Content-length: %ud\r\n", c->npostbody); if(httpdebug){ - fprint(2, "<- Content-type: %s\n", PostContentType); + if(c->hdr == nil) + fprint(2, "<- Content-type: %s\n", PostContentType); fprint(2, "<- Content-length: %ud\n", c->npostbody); } } --- /n/sources/plan9/sys/src/cmd/webfs/dat.h Fri Mar 18 10:00:08 2011 +++ /sys/src/cmd/webfs/dat.h Fri Jun 19 00:00:00 2026 @@ -33,6 +33,7 @@ struct Client char *redirect; char *authenticate; char *ext; + char *hdr; int npostbody; int havepostbody; int iobusy; --- /n/sources/plan9/sys/src/cmd/webfs/client.c Tue Feb 10 06:00:03 2009 +++ /sys/src/cmd/webfs/client.c Fri Jun 19 00:00:00 2026 @@ -57,6 +57,8 @@ closeclient(Client *c) c->redirect = nil; free(c->authenticate); c->authenticate = nil; + free(c->hdr); + c->hdr = nil; c->npostbody = 0; c->havepostbody = 0; c->bodyopened = 0; @@ -322,7 +324,15 @@ clientctlwrite(Req *r, Client *c, char *cmd, char *arg) { void *a; Ctab *t; + char *p; + if(strcmp(cmd, "headers") == 0){ + p = smprint("%s%s\r\n", c->hdr ? c->hdr : "", arg); + free(c->hdr); + c->hdr = p; + respond(r, nil); + return 1; + } if((t = findcmd(cmd, clienttab, nelem(clienttab))) == nil) return 0; a = (void*)((uintptr)c+(uintptr)t->offset);