Handle unparseable URLs sent via plumber.
[rsc] --rw-rw-r-- M 320859 glenda sys 6818 Oct 27 10:18 sys/src/cmd/webfs/client.c
/n/sourcesdump/2005/1027/plan9/sys/src/cmd/webfs/client.c:139,151 -
/n/sourcesdump/2005/1028/plan9/sys/src/cmd/webfs/client.c:139,162
{
int i;
Client *c;
+ Url *ubase, *uurl;
+ ubase = nil;
+ if(base){
+ ubase = parseurl(base, nil);
+ if(ubase == nil)
+ return;
+ }
+ uurl = parseurl(url, ubase);
+ if(uurl == nil){
+ freeurl(ubase);
+ return;
+ }
i = newclient(1);
c = client[i];
c->ref++;
- if(base != nil)
- c->baseurl = parseurl(base, nil);
- c->url = parseurl(url, c->baseurl);
+ c->baseurl = ubase;
+ c->url = uurl;
sendp(c->creq, nil);
}
/n/sourcesdump/2005/1027/plan9/sys/src/cmd/webfs/client.c:177,182 -
/n/sourcesdump/2005/1028/plan9/sys/src/cmd/webfs/client.c:188,197
c = a;
if(c->plumbed) {
recvp(c->creq);
+ if(c->url == nil){
+ fprint(2, "bad url got plumbed\n");
+ return;
+ }
clientbodyopen(c, nil);
replumb(c);
}
|