From 026c679f49ca89b7585d3ee3364d154c2b00cc3a Mon Sep 17 00:00:00 2001 From: mischief Date: Tue, 18 Sep 2018 13:14:00 -0700 Subject: webfs: remove automatic Referer header automatic Referer headers were found to break downloads from sourceforge.net, causing html pages to appear instead of tarballs. if a website does need them, they can be added as needed via hget's -r flag, or added to mothra. reverts commits 67f536d20329 and 6d999c39a9f0 --- sys/src/cmd/webfs/fs.c | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/sys/src/cmd/webfs/fs.c b/sys/src/cmd/webfs/fs.c index 27431b8bf..6b4f4990d 100644 --- a/sys/src/cmd/webfs/fs.c +++ b/sys/src/cmd/webfs/fs.c @@ -407,33 +407,6 @@ fsopen(Req *r) if(!lookkey(cl->hdr, "Accept")) cl->hdr = addkey(cl->hdr, "Accept", "*/*"); - if(!lookkey(cl->hdr, "Referer")){ - char *r; - Url *u; - - /* - * Referer header is often required on broken - * websites even if the spec makes them optional, - * so we make one up. - */ - if(u = url("/", cl->url)){ - if(r = u->host){ - u->host = smprint("%N", r); - free(r); - } - - /* do not send credentials */ - free(u->user); u->user = nil; - free(u->pass); u->pass = nil; - - if(r = smprint("%U", u)){ - cl->hdr = addkey(cl->hdr, "Referer", r); - free(r); - } - freeurl(u); - } - } - if(!lookkey(cl->hdr, "Connection")) cl->hdr = addkey(cl->hdr, "Connection", "keep-alive"); -- cgit v1.2.3