l = strlen(name) + strlen(r->headers[i].rh_value) + 6;
l = strlen(name) + strlen(r->headers[i].rh_value) + 7;
static int add_http_vars(struct request *r, struct cgi_parameters *cp){	size_t i, j, k, l, n;	int c, *seen;	char *tmp, *b, **e;	const char *name;	n = r->nheaders;	if (n == 0)		return 0;	seen = malloc(n * sizeof *seen);	if (seen == 0)		return -1;	for (i = 0; i < n; i++)		seen[i] = 0;	for (i = 0; i < n; i++) {		if (seen[i])			continue;		name = r->headers[i].rh_name;		if (strcasecmp(name, "Authorization") == 0 && r->user && r->user[0])			continue;		l = strlen(name) + strlen(r->headers[i].rh_value) + 6;		for (j = i + 1; j < n; j++) {			if (seen[j])				continue;			if (strcasecmp(r->headers[j].rh_name, name) == 0) {				seen[j] = 1;				l += strlen(r->headers[j].rh_name) + 2;			}		}		tmp = malloc(l);		if (tmp == 0) {			free(seen);			return -1;		}		memcpy(tmp, "HTTP_", 5);		b = tmp + 5;		l = strlen(name);		for (k = 0; k < l; k++) {			c = toupper(name[k]);			if (c == '-')				c = '_';			*b++ = c;		}		b += sprintf(b, "=%s", r->headers[i].rh_value);		for (j = i + 1; j < n; j++) {			if (seen[j] == 1) {				b += sprintf(b, ",%s", r->headers[j].rh_value);				seen[j] = 2;			}		}		e = realloc(cp->cgi_envp, (cp->cgi_envc + 1) * sizeof *cp->cgi_envp);		if (e == 0) {			free(tmp);			free(seen);			return -1;		}		cp->cgi_envp = e;		cp->cgi_envp[cp->cgi_envc] = tmp;		++cp->cgi_envc;	}	free(seen);	return 0;}