summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormischief <mischief@offblast.org>2018-09-18 13:14:00 -0700
committermischief <mischief@offblast.org>2018-09-18 13:14:00 -0700
commit026c679f49ca89b7585d3ee3364d154c2b00cc3a (patch)
treef2d3c8fcdb309a6a3f7af6704e72a401132f9f83
parent6b9cc409de48052e4474150236a22a4b6b44fceb (diff)
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
-rw-r--r--sys/src/cmd/webfs/fs.c27
1 files changed, 0 insertions, 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");