buf.c:15: 	b->fd = fd;
buf.c:16: 	b->io = io;
buf.c:17: 	b->rp = b->wp = b->buf;
buf.c:25: 	n = b->wp - b->rp;
buf.c:29: 		memmove(buf, b->rp, n);
buf.c:30: 		b->rp += n;
buf.c:33: 	return ioread(b->io, b->fd, buf, len);
buf.c:42: 	n = b->wp - b->rp;
buf.c:43: 	memmove(&b->buf[i+1], b->rp, n);
buf.c:44: 	memmove(b->buf, line, i);
buf.c:45: 	b->buf[i] = '\n';
buf.c:46: 	b->rp = b->buf;
buf.c:47: 	b->wp = b->rp+i+1+n;
buf.c:56: 	len--;
buf.c:59: 		if(b->rp >= b->wp){
buf.c:60: 			n = ioread(b->io, b->fd, b->wp, sizeof(b->buf)/2);
buf.c:62: 				return -1;
buf.c:65: 			b->wp += n;
buf.c:67: 		n = *b->rp++;
buf.c:70: 			len--;
buf.c:80: 		n = *(p-1);
buf.c:83: 		p--;
buf.c:87: 	return p-buf;
client.c:23: 		if(client[i]->ref==0)
client.c:27: 	c->plumbed = plumbed;
client.c:28: 	c->creq = chancreate(sizeof(Req*), 8);
client.c:31: 	c->io = ioproc();
client.c:32: 	c->num = nclient;
client.c:33: 	c->ctl = globalctl;
client.c:34: 	clonectl(&c->ctl);
client.c:38: 	return nclient-1;
client.c:44: 	if(--c->ref == 0){
client.c:45: 		if(c->bodyopened){
client.c:46: 			if(c->url && c->url->close)
client.c:47: 				(*c->url->close)(c);
client.c:48: 			c->bodyopened = 0;
client.c:50: 		free(c->contenttype);
client.c:51: 		c->contenttype = nil;
client.c:52: 		free(c->postbody);
client.c:53: 		c->postbody = nil;
client.c:54: 		freeurl(c->url);
client.c:55: 		c->url = nil;
client.c:56: 		free(c->redirect);
client.c:57: 		c->redirect = nil;
client.c:58: 		free(c->authenticate);
client.c:59: 		c->authenticate = nil;
client.c:60: 		c->npostbody = 0;
client.c:61: 		c->havepostbody = 0;
client.c:62: 		c->bodyopened = 0;
client.c:69: 	if(c->useragent)
client.c:70: 		c->useragent = estrdup(c->useragent);
client.c:81: 	for(i=0; i<=c->ctl.redirectlimit; i++){
client.c:82: 		if(c->url == nil){
client.c:86: 		if(c->url->open == nil){
client.c:91: 			fprint(2, "try %s\n", c->url->url);
client.c:92: 		if(c->url->open(c, c->url) < 0){
client.c:98: 			c->iobusy = 0;
client.c:100: 				r->fid->omode = -1;
client.c:106: 		if(c->authenticate)
client.c:108: 		if(!c->redirect)
client.c:110: 		next = c->redirect;
client.c:111: 		c->redirect = nil;
client.c:112: 		if(i==c->ctl.redirectlimit){
client.c:116: 		if((u = parseurl(next, c->url)) == nil)
client.c:119: 			fprint(2, "parseurl %s got scheme %d\n", next, u->ischeme);
client.c:120: 		if(u->ischeme == USunknown){
client.c:124: 		if(u->ischeme == UScurrent){
client.c:128: 		freeurl(c->url);
client.c:129: 		c->url = u;
client.c:132: 	c->iobusy = 0;
client.c:157: 	c->ref++;
client.c:158: 	c->baseurl = ubase;
client.c:159: 	c->url = uurl;
client.c:160: 	sendp(c->creq, nil);
client.c:168: 	if(c->url->read == nil){
client.c:172: 	if(c->url->read(c, r) < 0){
client.c:174: 		c->iobusy = 0;
client.c:178: 	c->iobusy = 0;
client.c:189: 	if(c->plumbed) {
client.c:190: 		recvp(c->creq);
client.c:191: 		if(c->url == nil){
client.c:198: 	while((r = recvp(c->creq)) != nil){
client.c:200: 			fprint(2, "clientthread %F\n", &r->ifcall);
client.c:201: 		switch(r->ifcall.type){
client.c:203: 			if(c->plumbed) {
client.c:204: 				c->plumbed = 0;
client.c:205: 				c->ref--;			/* from plumburl() */
client.c:315: 	a = (void*)((uintptr)ctl+(uintptr)t->offset);
client.c:316: 	parseas(r, arg, t->type, a);
client.c:328: 	a = (void*)((uintptr)c+(uintptr)t->offset);
client.c:329: 	parseas(r, arg, t->type, a);
client.c:341: 	a = t->offset;
client.c:342: 	parseas(r, arg, t->type, a);
client.c:376: 	sprint(buf, "%11d \n", c->num);
client.c:377: 	ctlfmt(&c->ctl, buf+strlen(buf));
cookies.c:85: 	jar = va_arg(fp->args, Jar*);
cookies.c:87: 	if(jar == nil || jar->nc == 0)
cookies.c:91: 	if(jar->c[0].version)
cookies.c:92: 		fmtprint(fp, "$Version=%s; ", jar->c[0].version);
cookies.c:93: 	for(i=0; i<jar->nc; i++)
cookies.c:94: 		fmtprint(fp, "%s%s=%s", i ? "; ": "", jar->c[i].name, jar->c[i].value);
cookies.c:107: 	c = va_arg(fp->args, Cookie*);
cookies.c:135:  *	- alpha by name
cookies.c:136:  *	- alpha by domain
cookies.c:137:  *	- longer paths first, then alpha by path (RFC2109 4.3.4)
cookies.c:144: 	if((i = strcmp(a->name, b->name)) != 0)
cookies.c:146: 	if((i = cistrcmp(a->dom, b->dom)) != 0)
cookies.c:148: 	if((i = strlen(b->path) - strlen(a->path)) != 0)
cookies.c:150: 	if((i = strcmp(a->path, b->path)) != 0)
cookies.c:162: 	if((i = strcmp(a->value, b->value)) != 0)
cookies.c:164: 	if(a->version || b->version){
cookies.c:165: 		if(!a->version)
cookies.c:166: 			return -1;
cookies.c:167: 		if(!b->version)
cookies.c:169: 		if((i = strcmp(a->version, b->version)) != 0)
cookies.c:172: 	if(a->comment || b->comment){
cookies.c:173: 		if(!a->comment)
cookies.c:174: 			return -1;
cookies.c:175: 		if(!b->comment)
cookies.c:177: 		if((i = strcmp(a->comment, b->comment)) != 0)
cookies.c:180: 	if((i = b->expire - a->expire) != 0)
cookies.c:182: 	if((i = b->secure - a->secure) != 0)
cookies.c:184: 	if((i = b->explicitdom - a->explicitdom) != 0)
cookies.c:186: 	if((i = b->explicitpath - a->explicitpath) != 0)
cookies.c:188: 	if((i = b->netscapestyle - a->netscapestyle) != 0)
cookies.c:221: 	j->dirty = 1;
cookies.c:222: 	i = c - j->c;
cookies.c:223: 	if(i < 0 || i >= j->nc)
cookies.c:225: 	c->deleted = 1;
cookies.c:233: 	if(!c->name || !c->value || !c->path || !c->dom){
cookies.c:241: 	for(i=0; i<j->nc; i++)
cookies.c:242: 		if(cookiecmp(&j->c[i], c) == 0){
cookies.c:244: 				fprint(2, "cookie %K matches %K\n", &j->c[i], c);
cookies.c:245: 			if(exactcookiecmp(&j->c[i], c) == 0){
cookies.c:248: 				j->c[i].mark = 0;
cookies.c:251: 			delcookie(j, &j->c[i]);
cookies.c:254: 	j->dirty = 1;
cookies.c:255: 	if(j->nc == j->mc){
cookies.c:256: 		j->mc += 16;
cookies.c:257: 		j->c = erealloc9p(j->c, j->mc*sizeof(Cookie));
cookies.c:259: 	j->c[j->nc] = *c;
cookies.c:260: 	copycookie(&j->c[j->nc]);
cookies.c:261: 	j->nc++;
cookies.c:269: 	for(i=j->nc-1; i>=0; i--){
cookies.c:270: 		if(!j->c[i].deleted)
cookies.c:272: 		freecookie(&j->c[i]);
cookies.c:273: 		--j->nc;
cookies.c:274: 		j->c[i] = j->c[j->nc];
cookies.c:338: 	for(i=0; i<jar->nc; i++){
cookies.c:339: 		if(jar->c[i].expire < now || (exiting && jar->c[i].expire==~0)){
cookies.c:340: 			delcookie(jar, &jar->c[i]);
cookies.c:357: 	for(i=0; i<jar->nc; i++)
cookies.c:358: 		print("\t%K%s%s%s\n", &jar->c[i],
cookies.c:359: 			jar->c[i].ondisk ? " ondisk" : "",
cookies.c:360: 			jar->c[i].deleted ? " deleted" : "",
cookies.c:361: 			jar->c[i].mark ? " mark" : "");
cookies.c:363: 	if((b = Bopen(jar->file, OREAD)) == nil){
cookies.c:384: 	if(jar->file==nil)
cookies.c:388: 	if((d = dirstat(jar->file)) != nil){
cookies.c:389: 		q = d->qid;
cookies.c:390: 		if(d->qid.path != jar->qid.path || d->qid.vers != jar->qid.vers)
cookies.c:391: 			jar->dirty = 1;
cookies.c:395: 	if(jar->dirty == 0)
cookies.c:398: 	fd = -1;
cookies.c:400: 		if((fd = create(jar->lockfile, OWRITE, DMEXCL|0666)) < 0){
cookies.c:408: 			fprint(2, "open %s: %r", jar->lockfile);
cookies.c:410: 		return -1;
cookies.c:413: 	for(i=0; i<jar->nc; i++)	/* mark is cleared by addcookie */
cookies.c:414: 		jar->c[i].mark = jar->c[i].ondisk;
cookies.c:416: 	if((b = Bopen(jar->file, OREAD)) == nil){
cookies.c:418: 			fprint(2, "Bopen %s: %r", jar->file);
cookies.c:419: 		werrstr("cannot read cookie file %s: %r", jar->file);
cookies.c:421: 		return -1;
cookies.c:430: 	for(i=0; i<jar->nc; i++)
cookies.c:431: 		if(jar->c[i].mark && jar->c[i].expire != ~0)
cookies.c:432: 			delcookie(jar, &jar->c[i]);
cookies.c:436: 	b = Bopen(jar->file, OWRITE);
cookies.c:439: 			fprint(2, "Bopen write %s: %r", jar->file);
cookies.c:441: 		return -1;
cookies.c:444: 	Bprint(b, "# comments and non-standard fields will be lost\n");
cookies.c:445: 	for(i=0; i<jar->nc; i++){
cookies.c:446: 		if(jar->c[i].expire == ~0)
cookies.c:448: 		Bprint(b, "%K\n", &jar->c[i]);
cookies.c:449: 		jar->c[i].ondisk = 1;
cookies.c:453: 	jar->dirty = 0;
cookies.c:455: 	if((d = dirstat(jar->file)) != nil){
cookies.c:456: 		jar->qid = d->qid;
cookies.c:478: 	jar->lockfile = lock;
cookies.c:479: 	jar->file = file;
cookies.c:480: 	jar->dirty = 1;
cookies.c:483: 		free(jar->file);
cookies.c:484: 		free(jar->lockfile);
cookies.c:502: 	for(i=0; i<jar->nc; i++)
cookies.c:503: 		freecookie(&jar->c[i]);
cookies.c:505: 	free(jar->file);
cookies.c:514:  * name domain-matches host B's if
cookies.c:522:  * * A is a FQDN string and has the form NB, where N is a non-empty name
cookies.c:524:  *   domain-matches .y.com but not y.com.)
cookies.c:526:  * Note that domain-match is not a commutative operation: a.b.c.com
cookies.c:527:  * domain-matches .c.com, but not the reverse.
cookies.c:529:  * (This does not verify that IP addresses and FQDN's are well-formed.)
cookies.c:542: 		if(lname >= lpattern && cistrcmp(name+lname-lpattern, pattern)==0)
cookies.c:551:  *	- domain must match
cookies.c:552:  *	- path in cookie must be a prefix of request path
cookies.c:553:  *	- cookie must not have expired
cookies.c:558: 	return isdomainmatch(dom, c->dom)
cookies.c:559: 		&& strncmp(c->path, path, strlen(c->path))==0
cookies.c:560: 		&& c->expire >= now;
cookies.c:578: 	for(i=0; i<jar->nc; i++){
cookies.c:580: 			fprint(2, "\ttry %s %s %d %s\n", jar->c[i].dom, jar->c[i].path, jar->c[i].secure, jar->c[i].name);
cookies.c:581: 		if((issecure || !jar->c[i].secure) && iscookiematch(&jar->c[i], dom, path, now)){
cookies.c:584: 			addcookie(j, &jar->c[i]);
cookies.c:587: 	if(j->nc == 0){
cookies.c:592: 	qsort(j->c, j->nc, sizeof(j->c[0]), (int(*)(const void*, const void*))cookiecmp);
cookies.c:602: 	if(strncmp(c->path, path, strlen(c->path)) != 0)
cookies.c:605: 	if(c->explicitdom && c->dom[0] != '.')
cookies.c:608: 	if(memchr(c->dom+1, '.', strlen(c->dom)-1-1) == nil)
cookies.c:611: 	if(!isdomainmatch(dom, c->dom))
cookies.c:615: 	&& memchr(dom, '.', strlen(dom)-strlen(c->dom)) != nil)
cookies.c:622:  * Sunday, 25-Jan-2002 12:24:36 GMT
cookies.c:667: 		return -1;
cookies.c:672: 		return -1;
cookies.c:675: 	/* 25- */
cookies.c:676: 	if(!isdigit(s[0]) || !isdigit(s[1]) || (s[2]!='-' && s[2]!=' ')){
cookies.c:679: 		return -1;
cookies.c:684: 	/* Jan- */
cookies.c:694: 		return -1;
cookies.c:696: 	if(s[0] != '-' && s[0] != ' '){
cookies.c:699: 		return -1;
cookies.c:707: 		return -1;
cookies.c:722: 		return -1;
cookies.c:724: 	tm.year -= 1900;
cookies.c:728: 		return -1;
cookies.c:736: 		return -1;
cookies.c:745: 		return -1;
cookies.c:752: 		return -1;
cookies.c:773:  *	- didn't allow spaces around the '='
cookies.c:774:  *	- used an 'Expires' attribute
cookies.c:775:  *	- had no 'Version' attribute
cookies.c:776:  *	- had no quotes
cookies.c:777:  *	- allowed whitespace in values
cookies.c:778:  *	- apparently separated attr/value pairs with ';' exclusively
cookies.c:786: 		if(isspace(s[1]) || (s > hdr && isspace(s[-1])))
cookies.c:804: 	static char setcookie[] = "Set-Cookie:";
cookies.c:845: 	 * Sec 2.2 of RFC2616 defines a "quoted-string" as:
cookies.c:847: 	 *  quoted-string  = ( <"> *(qdtext | quoted-pair ) <"> )
cookies.c:849: 	 *  quoted-pair    = "\" CHAR
cookies.c:853: 	 * CHARs are ASCII octets 0-127;  (NOTE: we reject 0's)
cookies.c:854: 	 * CTLs are octets 0-31 and 127;
cookies.c:871: 	 * CHARs are ASCII octets 0-127;
cookies.c:872: 	 * CTLs are octets 0-31 and 127;
cookies.c:873: 	 * separators are "()<>@,;:\/[]?={}", double-quote, SP (32), and HT (9)
cookies.c:901:  * RMID=80b186bb64c03c65fab767f8; expires=Monday, 10-Feb-2003 04:44:39 GMT; 
cookies.c:910: 	c->expire = ~0;
cookies.c:915: 	c->name = p;
cookies.c:926: 	c->value = p;
cookies.c:928: 	if(c->name[0]=='\0' || c->value[0]=='\0')
cookies.c:973: 				return "non-netscape cookie has Expires tag";
cookies.c:976: 			c->expire = strtotime(val);
cookies.c:977: 			if(c->expire == ~0)
cookies.c:980: 		if(cistrcmp(attr, "max-age") == 0)
cookies.c:981: 			c->expire = time(0)+atoi(val);
cookies.c:983: 			c->secure = 1;
cookies.c:986: 	if(c->dom)
cookies.c:987: 		c->explicitdom = 1;
cookies.c:989: 		c->dom = dom;
cookies.c:990: 	if(c->path)
cookies.c:991: 		c->explicitpath = 1;
cookies.c:993: 		c->path = path;
cookies.c:994: 		if((t = strchr(c->path, '?')) != 0)
cookies.c:996: 		if((t = strrchr(c->path, '/')) != 0)
cookies.c:999: 	c->netscapestyle = isns;
cookies.c:1032: 	r->fid->aux = a;
cookies.c:1033: 	if(r->ifcall.mode&OTRUNC){
cookies.c:1034: 		a->ctext = emalloc9p(1);
cookies.c:1035: 		a->ctext[0] = '\0';
cookies.c:1037: 		sz = 256*jar->nc+1024;	/* BUG should do better */
cookies.c:1038: 		a->ctext = emalloc9p(sz);
cookies.c:1039: 		a->ctext[0] = '\0';
cookies.c:1040: 		s = a->ctext;
cookies.c:1042: 		for(i=0; i<jar->nc; i++)
cookies.c:1043: 			s = seprint(s, es, "%K\n", &jar->c[i]);
cookies.c:1053: 	a = r->fid->aux;
cookies.c:1054: 	readstr(r, a->ctext);
cookies.c:1064: 	a = r->fid->aux;
cookies.c:1065: 	sz = r->ifcall.count+r->ifcall.offset;
cookies.c:1066: 	if(sz > strlen(a->ctext)){
cookies.c:1071: 		a->ctext = erealloc9p(a->ctext, sz+1);
cookies.c:1072: 		a->ctext[sz] = '\0';
cookies.c:1074: 	memmove(a->ctext+r->ifcall.offset, r->ifcall.data, r->ifcall.count);
cookies.c:1075: 	r->ofcall.count = r->ifcall.count;
cookies.c:1086: 	a = fid->aux;
cookies.c:1089: 	for(i=0; i<jar->nc; i++)
cookies.c:1090: 		jar->c[i].mark = 1;
cookies.c:1091: 	for(p=a->ctext; *p; p=nextp){
cookies.c:1098: 	for(i=0; i<jar->nc; i++)
cookies.c:1099: 		if(jar->c[i].mark)
cookies.c:1100: 			delcookie(jar, &jar->c[i]);
cookies.c:1102: 	free(a->dom);
cookies.c:1103: 	free(a->path);
cookies.c:1104: 	free(a->inhttp);
cookies.c:1105: 	free(a->outhttp);
cookies.c:1106: 	free(a->ctext);
fs.c:10:  *		content-type		mime content-type of body
fs.c:117: 	d->uid = estrdup("web");
fs.c:118: 	d->gid = estrdup("web");
fs.c:119: 	d->qid.path = path;
fs.c:120: 	d->atime = d->mtime = time0;
fs.c:121: 	d->length = length;
fs.c:126: 		d->name = estrdup(buf);
fs.c:128: 	else if(t->name)
fs.c:129: 		d->name = estrdup(t->name);
fs.c:132: 		d->name = estrdup(buf);
fs.c:134: 	d->qid.type = t->mode>>24;
fs.c:135: 	d->mode = t->mode;
fs.c:141: 	fillstat(&r->d, r->fid->qid.path, 0, nil);
fs.c:155: 	i -= Qclient;
fs.c:159: 		free(d->name);
fs.c:160: 		d->name = estrdup(buf);
fs.c:163: 	return -1;
fs.c:174: 		fillstat(d, PATH(i, c->num), 0, c->ext);
fs.c:177: 	return -1;
fs.c:188: 		fillstat(d, PATH(i, c->num), 0, nil);
fs.c:191: 	return -1;
fs.c:202: 	path = r->fid->qid.path;
fs.c:233: 		if(c->contenttype == nil)
fs.c:234: 			r->ofcall.count = 0;
fs.c:236: 			readstr(r, c->contenttype);
fs.c:242: 		readbuf(r, c->postbody, c->npostbody);
fs.c:249: 		if(c->iobusy){
fs.c:253: 		c->iobusy = 1;
fs.c:254: 		sendp(c->creq, r);
fs.c:274: 		r->ofcall.count = 0;
fs.c:275: 		if(c->url != nil
fs.c:276: 		&& (s = *(char**)((uintptr)c->url+tab[TYPE(path)].offset)) != nil)
fs.c:291: 	path = r->fid->qid.path;
fs.c:304: 		if(r->ifcall.count >= 1024){
fs.c:308: 		buf = estredup(r->ifcall.data, (char*)r->ifcall.data+r->ifcall.count);
fs.c:316: 		r->ofcall.count = r->ifcall.count;
fs.c:323: 			if(!ctlwrite(r, &c->ctl, cmd, arg)
fs.c:332: 		if(c->bodyopened){
fs.c:336: 		if(r->ifcall.offset >= 128*1024*1024){	/* >128MB is probably a mistake */
fs.c:340: 		m = r->ifcall.offset + r->ifcall.count;
fs.c:341: 		if(c->npostbody < m){
fs.c:342: 			c->postbody = erealloc(c->postbody, m);
fs.c:343: 			memset(c->postbody+c->npostbody, 0, m-c->npostbody);
fs.c:344: 			c->npostbody = m;
fs.c:346: 		memmove(c->postbody+r->ifcall.offset, r->ifcall.data, r->ifcall.count);
fs.c:347: 		r->ofcall.count = r->ifcall.count;
fs.c:366: 	path = r->fid->qid.path;
fs.c:368: 	n = need[r->ifcall.mode&3];
fs.c:369: 	if((n&t->mode) != n){
fs.c:381: 		c->havepostbody++;
fs.c:382: 		c->ref++;
fs.c:389: 		if(c->url == nil){
fs.c:393: 		c->bodyopened = 1;
fs.c:394: 		c->ref++;
fs.c:395: 		sendp(c->creq, r);
fs.c:401: 		r->fid->qid.path = path;
fs.c:402: 		r->ofcall.qid.path = path;
fs.c:408: 		if(t-tab >= Qclient)
fs.c:409: 			client[NUM(path)]->ref++;
fs.c:425: 	if(r->ifcall.aname && r->ifcall.aname[0]){
fs.c:429: 	r->fid->qid.path = PATH(Qroot, 0);
fs.c:430: 	r->fid->qid.type = QTDIR;
fs.c:431: 	r->fid->qid.vers = 0;
fs.c:432: 	r->ofcall.qid = r->fid->qid;
fs.c:443: 	path = fid->qid.path;
fs.c:444: 	if(!(fid->qid.type&QTDIR))
fs.c:445: 		return "walk in non-directory";
fs.c:450: 			qid->path = PATH(Qclient, NUM(path));
fs.c:451: 			qid->type = tab[Qclient].mode>>24;
fs.c:455: 			qid->path = PATH(Qroot, 0);
fs.c:456: 			qid->type = tab[Qroot].mode>>24;
fs.c:469: 				qid->path = PATH(i, n);
fs.c:470: 				qid->type = tab[i].mode>>24;
fs.c:476: 			ext = client[NUM(path)]->ext;
fs.c:479: 				qid->path = PATH(i, NUM(path));
fs.c:480: 				qid->type = tab[i].mode>>24;
fs.c:485: 			qid->path = PATH(i, NUM(path));
fs.c:486: 			qid->type = tab[i].mode>>24;
fs.c:504: 	while(or->ifcall.type==Tflush)
fs.c:505: 		or = or->oldreq;
fs.c:507: 	if(or->ifcall.type != Tread && or->ifcall.type != Topen)
fs.c:510: 	path = or->fid->qid.path;
fs.c:516: 	sendp(c->creq, r);
fs.c:517: 	iointerrupt(c->io);
fs.c:542: 			path = fid->qid.path;
fs.c:545: 			if(fid->omode != -1 && TYPE(path) >= Qclient)
fs.c:550: 			switch(r->ifcall.type){
http.c:39: char PostContentType[] = "application/octet-stream";
http.c:61: 	if(hs->location == nil)
http.c:62: 		hs->location = estrdup(value);
http.c:68: 	if(hs->c->contenttype == nil)
http.c:69: 		hs->c->contenttype = estrdup(value);
http.c:70: 	if(hs->cache->contenttype == nil)
http.c:71: 		hs->cache->contenttype = estrdup(value);
http.c:80: 	s = hs->setcookie;
http.c:84: 	fmtprint(&f, "set-cookie: ");
http.c:90: 		hs->setcookie = t;
http.c:115: 	memmove(s, s+1, p-(s+1));
http.c:116: 	s[p-(s+1)] = 0;
http.c:131: 	if(p>addr && *(p-1) == 's')
http.c:132: 		p--;
http.c:133: 	if(p>addr+5 && strcmp(p-5, "!http") == 0)
http.c:134: 		p[-5] = 0;
http.c:148: 	hs->autherror[0] = 0;
http.c:159: 	user = hs->c->url->user;
http.c:160: 	pass = hs->c->url->passwd;
http.c:164: 		name = servername(hs->netaddr);
http.c:167: 		if(hs->c->url->user)
http.c:168: 			fmtprint(&fmt, " user=%q", hs->c->url->user);
http.c:174: 		user = up->user;
http.c:175: 		pass = up->passwd;
http.c:183: 	hs->credentials = smprint("Basic %s", cred);
http.c:184: 	if(hs->credentials == nil)
http.c:191: 	snprint(hs->autherror, sizeof hs->autherror, "%r");
http.c:195: 	char *name;									/* Case-insensitive */
http.c:199: 	{ "content-type:", contenttype },
http.c:200: 	{ "set-cookie:", setcookie },
http.c:201: 	{ "www-authenticate:", wwwauthenticate },
http.c:211: 	n = readline(&hs->b, buf, sizeof(buf)-1);
http.c:215: 		fprint(2, "-> %s\n", buf);
http.c:219: 		return -1;
http.c:238: 	n--;
http.c:241: 		i = readline(&hs->b, p, e-p);
http.c:252: 				unreadline(&hs->b, p);
http.c:260: 		fprint(2, "-> %s\n", buf);
http.c:261: 	return p-buf;
http.c:274: 			return -1;
http.c:300: 	fprint(2, "%d, %d, %s,%s", c->id, c->status, c->contenttype, c->url);
http.c:301: 	if(c->redirect)
http.c:302: 		fprint(2, " ->%s", c->redirect);
http.c:311: 	c->url = estrdup(url);
http.c:312: 	c->expires = -1;
http.c:313: 	c->contenttype = nil;
http.c:314: 	c->id = ++cacheid;
http.c:315: 	c->file = smprint("%s%d", cachedir, c->id);
http.c:316: 	c->wbuf = nil;
http.c:317: 	c->size = 0;
http.c:318: 	c->redirect = nil;
http.c:319: 	c->status = Cmissing;
http.c:320: 	c->next = nil;
http.c:321: 	//fprint(2, "<<newcacheitem(%s)->id==%d\n", url, c->id);
http.c:331: 	for(c = &cachelist; *c; c = &(*c)->next)
http.c:332: 		if(strcmp((*c)->url, url) == 0)
http.c:349: 	io = c->io;
http.c:351: 	hs->c = c;
http.c:352: 	hs->netaddr = estrdup(netmkaddr(url->host, 0, url->scheme));
http.c:353: 	c->aux = hs;
http.c:354: 	hs->cache = nil;
http.c:356: 		fprint(2, "dial %s\n", hs->netaddr);
http.c:359: 		hs->cache = getcache(url->url);
http.c:360: 		if(hs->cache->status == Cdone){
http.c:361: 			if(hs->cache->contenttype)
http.c:362: 				c->contenttype = estrdup(hs->cache->contenttype);
http.c:363: 			if(hs->cache->redirect){
http.c:364: 				c->redirect = hs->cache->redirect;
http.c:365: 				hs->location = nil;
http.c:367: 				fd = open(hs->cache->file, OREAD);
http.c:368: 				initibuf(&hs->b, io, fd);
http.c:372: 		else if(hs->cache->status == Cloading )
http.c:373: 			hs->cache = nil; // XXX Hack, don't use cache if this entry is loading.
http.c:377: 	fd = iotlsdial(io, hs->netaddr, 0, 0, 0, url->ischeme==UShttps);
http.c:382: 		free(hs->netaddr);
http.c:383: 		close(hs->fd);
http.c:384: 		hs->fd = -1;
http.c:385: 		if(hs->cache){
http.c:386: 			if(hs->cache->wbuf)
http.c:387: 				Bterm(hs->cache->wbuf);
http.c:390: 		c->aux = nil;
http.c:391: 		return -1;
http.c:393: 	hs->fd = fd;
http.c:395: 		fprint(2, "<- %s %s HTTP/1.0\n<- Host: %s\n",
http.c:396: 			c->havepostbody? "POST": " GET", url->http.page_spec, url->host);
http.c:398: 		c->havepostbody? "POST" : "GET", url->http.page_spec, url->host);
http.c:400: 		fprint(2, "<- User-Agent: %s\n", c->ctl.useragent);
http.c:401: 	if(c->ctl.useragent)
http.c:402: 		ioprint(io, fd, "User-Agent: %s\r\n", c->ctl.useragent);
http.c:403: 	if(c->ctl.sendcookies){
http.c:404: 		/* should we use url->page here?  sometimes it is nil. */
http.c:405: 		cookies = httpcookies(url->host, url->http.page_spec, 0);
http.c:409: 			fprint(2, "<- %s", cookies);
http.c:412: 	if(c->havepostbody){
http.c:413: 		ioprint(io, fd, "Content-type: %s\r\n", PostContentType);
http.c:414: 		ioprint(io, fd, "Content-length: %ud\r\n", c->npostbody);
http.c:416: 			fprint(2, "<- Content-type: %s\n", PostContentType);
http.c:417: 			fprint(2, "<- Content-length: %ud\n", c->npostbody);
http.c:420: 	if(c->authenticate){
http.c:421: 		ioprint(io, fd, "Authorization: %s\r\n", c->authenticate);
http.c:423: 			fprint(2, "<- Authorization: %s\n", c->authenticate);
http.c:426: 	if(c->havepostbody)
http.c:427: 		if(iowrite(io, fd, c->postbody, c->npostbody) != c->npostbody)
http.c:430: 	c->havepostbody = 0;
http.c:433: 	initibuf(&hs->b, io, fd);
http.c:437: 	case -1:	/* connection timed out */
http.c:451: 		if(ofile == nil && r->start != 0)
http.c:473: 		if(c->authenticate){
http.c:523: 	if(c->ctl.acceptcookies && hs->setcookie)
http.c:524: 		httpsetcookie(hs->setcookie, url->host, url->path);
http.c:526: 		if(!hs->credentials){
http.c:527: 			if(hs->autherror[0])
http.c:528: 				werrstr("%s", hs->autherror);
http.c:530: 				werrstr("unauthorized; no www-authenticate: header");
http.c:531: 			return -1;
http.c:533: 		c->authenticate = hs->credentials;
http.c:534: 		hs->credentials = nil;
http.c:537: 		if(!hs->location){
http.c:539: 			return -1;
http.c:541: 		c->redirect = hs->location;
http.c:542: 		if(hs->cache){
http.c:543: 			hs->cache->redirect = hs->location;
http.c:544: 			hs->cache->status = Cdone;
http.c:546: 		hs->location = nil;
http.c:547: 	} else if(hs->cache && hs->cache->status == Cloading){
http.c:548: 		if((hs->cache->wbuf = Bopen(hs->cache->file, OWRITE)) == nil){
http.c:549: 			fprint(2, "Warning: can't open cache file %s - %r", hs->cache->file);
http.c:550: 			hs->cache->status = Cmissing;
http.c:551: 			hs->cache = nil;
http.c:565: 	hs = c->aux;
http.c:566: 	dst = r->ofcall.data;
http.c:567: 	len = r->ifcall.count;
http.c:570: 		rlen = len - tot;
http.c:571: 		n = readibuf(&hs->b, dst + tot, rlen);
http.c:576: 				return -1;
http.c:581: 		if(hs->cache && hs->cache->wbuf){
http.c:582: 			if(Bwrite(hs->cache->wbuf, dst + tot, n) == n)
http.c:583: 				hs->cache->size += n;
http.c:585: 				fprint(2, "Warning: write error or short write for cache(%s) - %r",
http.c:586: 					hs->cache->file);
http.c:589: 	r->ofcall.count = tot;
http.c:598: 	hs = c->aux;
http.c:601: 	ioclose(c->io, hs->fd);
http.c:602: 	hs->fd = -1;
http.c:603: 	free(hs->location);
http.c:604: 	free(hs->setcookie);
http.c:605: 	free(hs->netaddr);
http.c:606: 	free(hs->credentials);
http.c:607: 	if(hs->cache && hs->cache->wbuf){
http.c:608: 		Bterm(hs->cache->wbuf);
http.c:609: 		hs->cache->wbuf = nil;
http.c:610: 		hs->cache->status = Cdone;
http.c:613: 	c->aux = nil;
io.c:60: 		return -1;
io.c:69: 		return -1;
main.c:27: 	fprint(2, "usage: webfs [-c cookies] [-m mtpt] [-s service]\n");
main.c:38: 		mainmem->flags |= POOL_PARANOIA|POOL_ANTAGONISM;
plumb.c:45: 		base = plumblookup(m->attr, "baseurl");
plumb.c:47: 			base = m->wdir;
plumb.c:48: 		plumburl(m->data, base);
plumb.c:72: 	a->name = name;
plumb.c:73: 	a->value = value;
plumb.c:74: 	a->next = m->attr;
plumb.c:75: 	m->attr = a;
plumb.c:83: 	a = m->attr;
plumb.c:85: 		next = a->next;
plumb.c:117: 	if(!c->plumbed)
plumb.c:120: 	m->src = "webfs";
plumb.c:121: 	m->dst = nil;
plumb.c:122: 	m->wdir = "/";
plumb.c:123: 	m->type = "text";
plumb.c:124: 	m->attr = nil;
plumb.c:125: 	addattr(m, "url", c->url->url);
plumb.c:126: 	ctype = c->contenttype;
plumb.c:129: 		addattr(m, "content-type", ctype);
plumb.c:138: 		p = strrchr(c->url->url, '/');
plumb.c:146: 	c->ext = ext;
plumb.c:147: if(0)fprint(2, "content type %s -> extension .%s\n", ctype, ext);
plumb.c:148: 	m->ndata = snprint(name, sizeof name, "/mnt/web/%d/body.%s", c->num, ext);
plumb.c:149: 	m->data = estrdup(name);
plumb.c:161: 	free(m->data);
url.c:4:  * are supported, using "server-based" naming authorities in the schemes.
url.c:10:  * defined to be composed of US-ASCII printable characters.
url.c:70:  * letters, digits, plus ("+"), period ("."), or hyphen ("-").  For
url.c:77:  * For server-based naming authorities (RFC2396 Sec 3.2.2):
url.c:84:  *    domainlabel   = alphanum | alphanum *( alphanum | "-" ) alphanum
url.c:85:  *    toplabel      = alpha | alpha *( alphanum | "-" ) alphanum
url.c:99:  * for well-formed literal IP addresses, etc.).
url.c:104:  * Instead of letting a "path" be 0-or-more characters as RFC2396 suggests, 
url.c:105:  * we'll say it's 1-or-more characters, 0-or-1 times.  This way, an absent
url.c:113: /* RE character-class components -- these go in brackets */
url.c:114: #define PUNCT			"\\-_.!~*'()"
url.c:116: #define ALNUM		"a-zA-Z0-9"
url.c:117: #define HEX			"0-9a-fA-F"
url.c:159: 	/* |-scheme-|      |-auth.-|  |path--|    |query|     |--|frag */
url.c:163: 	"^[a-z][a-z0-9+-.]*$", nil, 0,
url.c:171: 	"^(((" USERINFO_2 "*)@)?(((\\[[^\\]@]+\\])|([^:\\[@]+))(:([0-9]*))?)?)?$", nil, 0,
url.c:172: 	/* |----user info-----|  |--------host----------------|  |-port-| */
url.c:176: 	"^(([a-zA-Z0-9\\-.]+)|(\\[([a-fA-F0-9.:]+)\\]))$", nil, 0,
url.c:177: 	/* |--regular host--|     |-IPv6 literal-| */
url.c:182: 	/* |user-|  |pass-| */
url.c:203: 	/*|--|-path              |ftptype-| */
url.c:269: 		memmove(pdest, base, e-base);
url.c:270: 		pdest += e-base;
url.c:286: 		if((e == dest) || (*(e-1) == '/')){
url.c:287:  			memmove(e, e+2, pdest+1-(e+2));	/* +1 for NUL */
url.c:288: 			pdest -= 2;
url.c:294: 	if(pdest>dest && *(pdest-1)=='.' && 
url.c:295: 	  (pdest==dest+1 || *(pdest-2)=='/'))
url.c:296: 		*--pdest = '\0';
url.c:298: 	/* 6e: remove occurences of "seg/../", where seg != "..", left->right */
url.c:301: 		p = e - 1;
url.c:303: 			p--;
url.c:305: 			memmove(p+1, e+4, pdest+1-(e+4));
url.c:306: 			pdest -= (e+4) - (p+1);
url.c:312: 	if(pdest-3 > dest && memcmp(pdest-3, "/..", 3)==0){
url.c:313: 		p = pdest-3 - 1;
url.c:315: 			p--;
url.c:322: 	/* 6g: leading ".." segments are errors -- we'll just blat them out. */
url.c:331: 			memmove(p, s, pdest+1-s);
url.c:332: 			pdest -= s-p;
url.c:338: 		fprint(2, "merge_relative_path: '%s' + '%.*s' -> '%s'\n", base, rel_len, 
url.c:345:  * If successful, this just ends up freeing and replacing "u->url".
url.c:356: 		return -1;
url.c:358: 	if(base->scheme == nil){
url.c:360: 		return -1;
url.c:362: 	if(base->ischeme == USunknown){
url.c:364: 		return -1;
url.c:366: 	if(base->ischeme == UScurrent){
url.c:368: 		return -1;
url.c:370: 	assert(su->scheme.s == nil);
url.c:374: 	if(su->path.s==nil && su->scheme.s==nil && su->authority.s==nil && su->query.s==nil){
url.c:377: 			fprint(2, "url %s is relative to current document\n", u->url);
url.c:378: 		u->ischeme = UScurrent;
url.c:384: 	/* Over-estimate the maximum lengths, for allocation purposes */
url.c:387: 	if(base->path)
url.c:388: 		plen += strlen(base->path);
url.c:389: 	if(su->path.s)
url.c:390: 		plen += 1 + (su->path.e - su->path.s);
url.c:393: 	ulen += strlen(base->scheme) + 1;
url.c:394: 	if(su->authority.s)
url.c:395: 		ulen += 2 + (su->authority.e - su->authority.s);
url.c:397: 		ulen += 2 + ((base->authority) ? strlen(base->authority) : 0);
url.c:399: 	if(su->query.s)
url.c:400: 		ulen += 1 + (su->query.e - su->query.s);
url.c:401: 	else if(currentdoc && base->query)
url.c:402: 		ulen += 1 + strlen(base->query);
url.c:403: 	if(su->fragment.s)
url.c:404: 		ulen += 1 + (su->fragment.e - su->fragment.s);
url.c:405: 	else if(currentdoc && base->fragment)
url.c:406: 		ulen += 1 + strlen(base->fragment);
url.c:415: 	if(su->authority.s || (su->path.s && (su->path.s[0] == '/'))){
url.c:416: 		/* Is a "network-path" or "absolute-path"; don't merge with base path */
url.c:418: 		if(su->path.s){
url.c:419: 			memmove(ppath, su->path.s, su->path.e - su->path.s);
url.c:420: 			ppath += su->path.e - su->path.s;
url.c:424: 		/* Is a current-doc reference; just copy the path from the base URL */
url.c:425: 		if(base->path){
url.c:426: 			strcpy(ppath, base->path);
url.c:431: 		/* Is a relative-path reference; we have to merge it */
url.c:433: 		merge_relative_path(base->path,
url.c:434: 			su->path.s, su->path.e - su->path.s, ppath);
url.c:438: 	strcpy(purl, base->scheme);
url.c:441: 	if(su->authority.s){
url.c:444: 		memmove(purl, su->authority.s, su->authority.e - su->authority.s);
url.c:445: 		purl += su->authority.e - su->authority.s;
url.c:446: 	}else if(base->authority){
url.c:449: 		strcpy(purl, base->authority);
url.c:461: 	if(su->query.s){
url.c:463: 		memmove(purl, su->query.s, su->query.e - su->query.s);
url.c:464: 		purl += su->query.e - su->query.s;
url.c:465: 	}else if(currentdoc && base->query){
url.c:467: 		strcpy(purl, base->query);
url.c:471: 	if(su->fragment.s){
url.c:473: 		memmove(purl, su->query.s, su->query.e - su->query.s);
url.c:474: 		purl += su->fragment.e - su->fragment.s;
url.c:475: 	}else if(currentdoc && base->fragment){
url.c:477: 		strcpy(purl, base->fragment);
url.c:483: 		fprint(2, "resolve_relative: '%s' + '%s' -> '%s'\n", base->url, u->url, url);
url.c:484: 	free(u->url);
url.c:485: 	u->url = url;
url.c:502: 			fprint(2, "match%d: %.*s\n", j, utfnlen(m[j].sp, m[j].ep-m[j].sp), m[j].sp);
url.c:532: 		return -1;
url.c:536: 	 * Because we use NUL-terminated strings, as do many client and server
url.c:539:  	 * the components because, per RFC2396 sec. 2.4.1 - 2.4.2, '%' is reserved
url.c:546: 		return -1;
url.c:551: 	if(!regx(t->prog, url, m, t->size)){
url.c:553: 		return -1;
url.c:556: 	su->url.s = m[0].sp;
url.c:557: 	su->url.e = m[0].ep;
url.c:558: 	su->scheme.s = m[t->ind[0]].sp;
url.c:559: 	su->scheme.e = m[t->ind[0]].ep;
url.c:560: 	su->authority.s = m[t->ind[1]].sp;
url.c:561: 	su->authority.e = m[t->ind[1]].ep;
url.c:562: 	su->path.s = m[t->ind[2]].sp;
url.c:563: 	su->path.e = m[t->ind[2]].ep;
url.c:564: 	su->query.s = m[t->ind[3]].sp;
url.c:565: 	su->query.e = m[t->ind[3]].ep;
url.c:566: 	su->fragment.s = m[t->ind[4]].sp;
url.c:567: 	su->fragment.e = m[t->ind[4]].ep;
url.c:572: 			su->url.s ? utfnlen(su->url.s, su->url.e-su->url.s) : 10, su->url.s ? su->url.s : "",
url.c:573: 			su->scheme.s ? utfnlen(su->scheme.s, su->scheme.e-su->scheme.s) : 10, su->scheme.s ? su->scheme.s : "",
url.c:574: 			su->authority.s ? utfnlen(su->authority.s, su->authority.e-su->authority.s) : 10, su->authority.s ? su->authority.s : "",
url.c:575: 			su->path.s ? utfnlen(su->path.s, su->path.e-su->path.s) : 10, su->path.s ? su->path.s : "",
url.c:576: 			su->query.s ? utfnlen(su->query.s, su->query.e-su->query.s) : 10, su->query.s ? su->query.s : "",
url.c:577: 			su->fragment.s ? utfnlen(su->fragment.s, su->fragment.e-su->fragment.s) : 10, su->fragment.s ? su->fragment.s : "");
url.c:585: 	if(su->scheme.s == nil){
url.c:587: 		return -1;
url.c:589: 	u->scheme = estredup(su->scheme.s, su->scheme.e);
url.c:590: 	strlower(u->scheme);
url.c:592: 	if(!ismatch(REscheme, u->scheme, "scheme"))
url.c:593: 		return -1;
url.c:595: 	u->ischeme = ischeme(u->scheme);
url.c:597: 		fprint(2, "parse_scheme %s => %d\n", u->scheme, u->ischeme);
url.c:606: 	assert(u->ischeme == USunknown);
url.c:607: 	assert(su->scheme.e[0] == ':');
url.c:609: 	s = su->scheme.e+1;
url.c:610: 	if(su->fragment.s){
url.c:611: 		e = su->fragment.s-1;
url.c:616: 	u->schemedata = estredup(s, e);
url.c:617: 	if(!ismatch(REunknowndata, u->schemedata, "unknown scheme data"))
url.c:618: 		return -1;
url.c:631: 	if(!regx(t->prog, nil, m, t->size)){
url.c:632: 		werrstr("malformed userinfo: %.*q", utfnlen(s, e-s), s);
url.c:633: 		return -1;
url.c:635: 	if(m[t->ind[0]].sp)
url.c:636: 		u->user = estredup(m[t->ind[0]].sp, m[t->ind[0]].ep);
url.c:637: 	if(m[t->ind[1]].sp)
url.c:638: 		u->user = estredup(m[t->ind[1]].sp, m[t->ind[1]].ep);
url.c:651: 	if(!regx(t->prog, nil, m, t->size)){
url.c:652: 		werrstr("malformed host: %.*q", utfnlen(s, e-s), s);
url.c:653: 		return -1;
url.c:656: 	assert(m[t->ind[0]].sp || m[t->ind[1]].sp);
url.c:658: 	if(m[t->ind[0]].sp)	/* regular */
url.c:659: 		u->host = estredup(m[t->ind[0]].sp, m[t->ind[0]].ep);
url.c:661: 		u->host = estredup(m[t->ind[1]].sp, m[t->ind[1]].ep);
url.c:671: 	if(su->authority.s == nil)
url.c:674: 	u->authority = estredup(su->authority.s, su->authority.e);
url.c:677: 	if(!regx(t->prog, u->authority, m, t->size)){
url.c:678: 		werrstr("malformed authority: %q", u->authority);
url.c:679: 		return -1;
url.c:682: 	if(m[t->ind[0]].sp)
url.c:683: 		if(parse_userinfo(m[t->ind[0]].sp, m[t->ind[0]].ep, u) < 0)
url.c:684: 			return -1;
url.c:685: 	if(m[t->ind[1]].sp)
url.c:686: 		if(parse_host(m[t->ind[1]].sp, m[t->ind[1]].ep, u) < 0)
url.c:687: 			return -1;
url.c:688: 	if(m[t->ind[2]].sp)
url.c:689: 		u->port = estredup(m[t->ind[2]].sp, m[t->ind[2]].ep);
url.c:697: 	if(su->path.s == nil)
url.c:699: 	u->path = estredup(su->path.s, su->path.e);
url.c:700: 	if(!ismatch(REabspath, u->path, "absolute path"))
url.c:701: 		return -1;
url.c:708: 	if(su->query.s == nil)
url.c:710: 	u->query = estredup(su->query.s, su->query.e);
url.c:711: 	if(!ismatch(REquery, u->query, "query"))
url.c:712: 		return -1;
url.c:719: 	if(su->fragment.s == nil)
url.c:721: 	u->fragment = estredup(su->fragment.s, su->fragment.e);
url.c:722: 	if(!ismatch(REfragment, u->fragment, "fragment"))
url.c:723: 		return -1;
url.c:730: 	u->open = httpopen;
url.c:731: 	u->read = httpread;
url.c:732: 	u->close = httpclose;
url.c:734: 	if(u->authority==nil){
url.c:736: 		return -1;
url.c:738: 	if(u->host == nil){
url.c:740: 		return -1;
url.c:743: 	if(u->path == nil){
url.c:744: 		u->http.page_spec = estrdup("/");
url.c:748: 	if(!ismatch(REhttppath, u->path, "http path"))
url.c:749: 		return -1;
url.c:750: 	if(u->query){
url.c:751: 		u->http.page_spec = emalloc(strlen(u->path)+1+strlen(u->query)+1);
url.c:752: 		strcpy(u->http.page_spec, u->path);
url.c:753: 		strcat(u->http.page_spec, "?");
url.c:754: 		strcat(u->http.page_spec, u->query);
url.c:756: 		u->http.page_spec = estrdup(u->path);
url.c:767: 	if(u->authority==nil){
url.c:769: 		return -1;
url.c:771: 	if(u->query){
url.c:773: 		return -1;
url.c:775: 	if(u->host == nil){
url.c:777: 		return -1;
url.c:780: 	if(u->path == nil){
url.c:781: 		u->ftp.path_spec = estrdup("/");
url.c:787: 	if(!regx(t->prog, u->path, m, t->size)){
url.c:788: 		werrstr("malformed ftp path: %q", u->path);
url.c:789: 		return -1;
url.c:792: 	if(m[t->ind[0]].sp){
url.c:793: 		u->ftp.path_spec = estredup(m[t->ind[0]].sp, m[t->ind[0]].ep);
url.c:794: 		if(strchr(u->ftp.path_spec, ';')){
url.c:796: 			return -1;
url.c:799: 		u->ftp.path_spec = estrdup("/");
url.c:801: 	if(m[t->ind[1]].sp){
url.c:802: 		u->ftp.type = estredup(m[t->ind[1]].sp, m[t->ind[1]].ep);
url.c:803: 		strlower(u->ftp.type);
url.c:811: 	if(u->user || u->passwd){
url.c:813: 		return -1;
url.c:815: 	if(u->query){
url.c:817: 		return -1;
url.c:819: 	if(u->port){
url.c:821: 		return -1;
url.c:823: 	if(u->path == nil){
url.c:825: 		return -1;
url.c:827: 	if(strchr(u->path, ';')){
url.c:829: 		return -1;
url.c:832: 	if(!ismatch(REfilepath, u->path, "file path"))
url.c:833: 		return -1;
url.c:836: 	if(u->host && cistrcmp(u->host, "localhost") == 0){
url.c:837: 		free(u->host);
url.c:838: 		u->host = nil;
url.c:858: 		fprint(2, "parseurl %s with base %s\n", url, base ? base->url : "<none>");
url.c:861: 	u->url = estrdup(url);
url.c:862: 	if(spliturl(u->url, &su) < 0){
url.c:872: 		if(resolve_relative(&su, base, u) < 0 || spliturl(u->url, &su) < 0)
url.c:874: 		if(u->ischeme == UScurrent){
url.c:886: 	if(u->ischeme == USunknown){
url.c:897: 	if(u->ischeme < nelem(postparse) && postparse[u->ischeme])
url.c:898: 		if((*postparse[u->ischeme])(u) < 0)
url.c:910: 	free(u->url);
url.c:911: 	free(u->scheme);
url.c:912: 	free(u->schemedata);
url.c:913: 	free(u->authority);
url.c:914: 	free(u->user);
url.c:915: 	free(u->passwd);
url.c:916: 	free(u->host);
url.c:917: 	free(u->port);
url.c:918: 	free(u->path);
url.c:919: 	free(u->query);
url.c:920: 	free(u->fragment);
url.c:921: 	switch(u->ischeme){
url.c:923: 		free(u->http.page_spec);
url.c:926: 		free(u->ftp.path_spec);
url.c:927: 		free(u->ftp.type);
url.c:938: 	if(u->schemedata)
url.c:939: 		s = estrmanydup(u->scheme, ":", u->schemedata, nil);
url.c:941: 		s = estrmanydup(u->scheme, "://", 
url.c:942: 			u->user ? u->user : "",
url.c:943: 			u->passwd ? ":" : "", u->passwd ? u->passwd : "",
url.c:944: 			u->user ? "@" : "", u->host ? u->host : "", 
url.c:945: 			u->port ? ":" : "", u->port ? u->port : "",
url.c:946: 			u->path,
url.c:947: 			u->query ? "?" : "", u->query ? u->query : "",
url.c:948: 			u->fragment ? "#" : "", u->fragment ? u->fragment : "",
url.c:950: 	free(u->url);
url.c:951: 	u->url = s;
url.c:958: 		free(u->query);
url.c:959: 		u->query = nil;
url.c:964: 		return -1;
url.c:966: 	free(u->query);
url.c:967: 	u->query = estrdup(query);
url.c:985: 	dupp(&v->url);
url.c:986: 	dupp(&v->scheme);
url.c:987: 	dupp(&v->schemedata);
url.c:988: 	dupp(&v->authority);
url.c:989: 	dupp(&v->user);
url.c:990: 	dupp(&v->passwd);
url.c:991: 	dupp(&v->host);
url.c:992: 	dupp(&v->port);
url.c:993: 	dupp(&v->path);
url.c:994: 	dupp(&v->query);
url.c:995: 	dupp(&v->fragment);
url.c:997: 	switch(v->ischeme){
url.c:999: 		dupp(&v->http.page_spec);
url.c:1002: 		dupp(&v->ftp.path_spec);
url.c:1003: 		dupp(&v->ftp.type);
url.c:1013: 		return c-'0';
url.c:1015: 		return c-'a'+10;
url.c:1017: 		return c-'A'+10;
util.c:49: 	t = emalloc(e-s+1);
util.c:50: 	memmove(t, s, e-s);
util.c:51: 	t[e-s] = '\0';
util.c:84: 			*t += 'a'-'A';
webget.c:23: 	fprint(2, "usage: webget [-b baseurl] [-m mtpt] [-p postbody] url\n");
webget.c:58: 	if((n = read(ctlfd, buf, sizeof buf-1)) < 0)
