* [9fans] webfsget
@ 2006-07-15 0:27 erik quanstrom
2006-07-15 1:58 ` Dan Cross
0 siblings, 1 reply; 5+ messages in thread
From: erik quanstrom @ 2006-07-15 0:27 UTC (permalink / raw)
To: 9fans
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
- erik
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [9fans] webfsget
2006-07-15 1:58 ` Dan Cross
@ 2006-07-15 1:54 ` erik quanstrom
2006-07-15 3:10 ` uriel
0 siblings, 1 reply; 5+ messages in thread
From: erik quanstrom @ 2006-07-15 1:54 UTC (permalink / raw)
To: 9fans
[-- Attachment #1: Type: text/plain, Size: 682 bytes --]
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.
[-- Attachment #2: webfsdiff --]
[-- Type: text/plain, Size: 2891 bytes --]
/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;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [9fans] webfsget
2006-07-15 0:27 [9fans] webfsget erik quanstrom
@ 2006-07-15 1:58 ` Dan Cross
2006-07-15 1:54 ` erik quanstrom
0 siblings, 1 reply; 5+ messages in thread
From: Dan Cross @ 2006-07-15 1:58 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [9fans] webfsget
2006-07-15 3:10 ` uriel
@ 2006-07-15 3:08 ` erik quanstrom
0 siblings, 0 replies; 5+ messages in thread
From: erik quanstrom @ 2006-07-15 3:08 UTC (permalink / raw)
To: 9fans
i'm not convinced that a web browser needs to merge urls yet.
abaco de-relativeizes urls in a number of places. it would be
better for webfs to do that instead.
anyway, now that webfs does what it claims to do,
i realize the bug i've been tracking has nothing to do with relative urls.
so it's been useful for that. ☺
- erik
On Fri Jul 14 22:11:14 CDT 2006, uriel@cat-v.org wrote:
> I wonder if webfs should handle relative URLs at all. It adds a lot
> of complexity and I can't see any good use for it. I suspect the idea
> was to avoid other apps having to know how to parse and merge URLs,
> but in practice a web browser needs to know how to do that stuff
> anyway.
>
> Did you find a good use for this feature?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [9fans] webfsget
2006-07-15 1:54 ` erik quanstrom
@ 2006-07-15 3:10 ` uriel
2006-07-15 3:08 ` erik quanstrom
0 siblings, 1 reply; 5+ messages in thread
From: uriel @ 2006-07-15 3:10 UTC (permalink / raw)
To: 9fans
I wonder if webfs should handle relative URLs at all. It adds a lot
of complexity and I can't see any good use for it. I suspect the idea
was to avoid other apps having to know how to parse and merge URLs,
but in practice a web browser needs to know how to do that stuff
anyway.
Did you find a good use for this feature?
Thanks
uriel - Führer der Dissident Plan 9 IRC Kids
> 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.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-07-15 3:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-15 0:27 [9fans] webfsget erik quanstrom
2006-07-15 1:58 ` Dan Cross
2006-07-15 1:54 ` erik quanstrom
2006-07-15 3:10 ` uriel
2006-07-15 3:08 ` erik quanstrom
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).