ref: 5371b6ff15fc864ac5eeb041ab20827231d2e44b
parent: aa9097b4bbf566504c80689fa45b2e82aad56c36
author: cinap_lenrek <cinap_lenrek@centraldogma>
date: Sun Sep 4 23:30:07 EDT 2011
webfs: fix broken baseurl handling
--- a/sys/src/cmd/webfs/client.c
+++ b/sys/src/cmd/webfs/client.c
@@ -225,6 +225,7 @@
Bool,
Int,
String,
+ XRel,
XUrl,
Fn,
};
@@ -253,7 +254,7 @@
Ctab clienttab[] = {"baseurl", XUrl, (void*)offsetof(Client, baseurl),
- "url", XUrl, (void*)offsetof(Client, url),
+ "url", XRel, (void*)offsetof(Client, url),
};
static Ctab*
@@ -270,9 +271,10 @@
static void
parseas(Req *r, char *arg, int type, void *a)
{- Url *u;
+ Url *u, *base;
char e[ERRMAX];
+ base = nil;
switch(type){case Bool:
if(strcmp(arg, "on")==0 || strcmp(arg, "1")==0)
@@ -284,8 +286,10 @@
free(*(char**)a);
*(char**)a = estrdup(arg);
break;
+ case XRel:
+ base = ((Client*)a)->baseurl;
case XUrl:
- u = parseurl(arg, nil);
+ u = parseurl(arg, base);
if(u == nil){snprint(e, sizeof e, "parseurl: %r");
respond(r, e);
--- a/sys/src/cmd/webfs/dat.h
+++ b/sys/src/cmd/webfs/dat.h
@@ -24,6 +24,7 @@
{Url *url;
Url *baseurl;
+
Ctl ctl;
Channel *creq; /* chan(Req*) */
int num;
--
⑨