From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: From: erik quanstrom Date: Fri, 14 Jul 2006 20:54:32 -0500 To: 9fans@cse.psu.edu Subject: Re: [9fans] webfsget In-Reply-To: <20060715015819.GA679@augusta.math.psu.edu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-gjbxfbgbbkoiestrcniaaahueg" Topicbox-Message-UUID: 8031856c-ead1-11e9-9d60-3106f5b1d025 This is a multi-part message in MIME format. --upas-gjbxfbgbbkoiestrcniaaahueg Content-Disposition: ainline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit that is what's intended. the base url is http://swtch.com/~rsc/ the relative url is rsc-small.jpg thus webfsget -b $base $url i've attached a proposed fix. it appears (unless i'm reading the source incorrectly) that webfs didn't do relative urls unless they' were plumbed. - erik On Fri Jul 14 20:59:14 CDT 2006, cross@math.psu.edu wrote: > On Fri, Jul 14, 2006 at 07:27:25PM -0500, erik quanstrom wrote: > > is there something obvious wrong with this? > > > > webfsget -b http://swtch.com/~rsc/ rsc-small.jpg > > webfsget: get ctl write: parseurl: relative URI given without base > > Other than the space before the filename in the URL? > > - Dan C. --upas-gjbxfbgbbkoiestrcniaaahueg Content-Disposition: attachment; filename=webfsdiff Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit /n/sources/plan9/sys/src/cmd/webfs/client.c:233,258 - client.c:233,259 char *name; int type; void *offset; + void *offset2; }; Ctab ctltab[] = { - "acceptcookies", Bool, (void*)offsetof(Ctl, acceptcookies), - "sendcookies", Bool, (void*)offsetof(Ctl, sendcookies), - "redirectlimit", Int, (void*)offsetof(Ctl, redirectlimit), - "useragent", String, (void*)offsetof(Ctl, useragent), + "acceptcookies", Bool, (void*)offsetof(Ctl, acceptcookies), 0, + "sendcookies", Bool, (void*)offsetof(Ctl, sendcookies), 0, + "redirectlimit", Int, (void*)offsetof(Ctl, redirectlimit), 0, + "useragent", String, (void*)offsetof(Ctl, useragent), 0, }; Ctab globaltab[] = { - "chatty9p", Int, &chatty9p, - "fsdebug", Int, &fsdebug, - "cookiedebug", Int, &cookiedebug, - "urldebug", Int, &urldebug, - "httpdebug", Int, &httpdebug, + "chatty9p", Int, &chatty9p, 0, + "fsdebug", Int, &fsdebug, 0, + "cookiedebug", Int, &cookiedebug, 0, + "urldebug", Int, &urldebug, 0, + "httpdebug", Int, &httpdebug, 0, }; Ctab clienttab[] = { - "baseurl", XUrl, (void*)offsetof(Client, baseurl), - "url", XUrl, (void*)offsetof(Client, url), + "baseurl", XUrl, (void*)offsetof(Client, baseurl), 0, + "url", XUrl, (void*)offsetof(Client, url), (void*)offsetof(Client, baseurl), }; static Ctab* /n/sources/plan9/sys/src/cmd/webfs/client.c:267,273 - client.c:268,274 } static void - parseas(Req *r, char *arg, int type, void *a) + parseas(Req *r, char *arg, int type, void *a, void *b) { Url *u; char e[ERRMAX]; /n/sources/plan9/sys/src/cmd/webfs/client.c:284,290 - client.c:285,291 *(char**)a = estrdup(arg); break; case XUrl: - u = parseurl(arg, nil); + u = parseurl(arg, *(Url**)b); if(u == nil){ snprint(e, sizeof e, "parseurl: %r"); respond(r, e); /n/sources/plan9/sys/src/cmd/webfs/client.c:312,318 - client.c:313,319 if((t = findcmd(cmd, ctltab, nelem(ctltab))) == nil) return 0; a = (void*)((uintptr)ctl+(uintptr)t->offset); - parseas(r, arg, t->type, a); + parseas(r, arg, t->type, a, 0); return 1; } /n/sources/plan9/sys/src/cmd/webfs/client.c:319,331 - client.c:320,333 int clientctlwrite(Req *r, Client *c, char *cmd, char *arg) { - void *a; + void *a, *b; Ctab *t; if((t = findcmd(cmd, clienttab, nelem(clienttab))) == nil) return 0; a = (void*)((uintptr)c+(uintptr)t->offset); - parseas(r, arg, t->type, a); + b = (void*)((uintptr)c+(uintptr)t->offset2); + parseas(r, arg, t->type, a, b); return 1; } /n/sources/plan9/sys/src/cmd/webfs/client.c:338,344 - client.c:340,346 if((t = findcmd(cmd, globaltab, nelem(globaltab))) == nil) return 0; a = t->offset; - parseas(r, arg, t->type, a); + parseas(r, arg, t->type, a, 0); return 1; } --upas-gjbxfbgbbkoiestrcniaaahueg--