if (referer) { str = malloc(9 + strlen(referer) + 1); if (str) { strcpy(str, "Referer: "); strcat(str, referer); *r++ = str; viewReport(app, str); } }
getHTTPRequestHeaders(App *app, char *host, char *verbose){	char		**e;	extern char	**environ;	int		firstLetter;	char		**h;	char		*p;	char		*q;	char		**r;	char		**ret;	char		*scriptName;	char		*str;	scriptName = "view.cgi";	e = environ;	while (*e)	{		e++;	}	ret = malloc((e - environ + 1) * sizeof(*e));	if (!ret)	{		return NULL;	}	me = malloc(strlen(scriptName) + strlen(verbose) + 1);	if (!me)	{		return NULL;	}	strcpy(me, scriptName);	strcat(me, verbose);	e = environ;	r = ret;	viewReport(app, "will send these HTTP Request headers:");	while (*e)	{		h = passThese;		while (*h)		{			if (!strncmp(*e, *h, strlen(*h)))			{				break;			}			h++;		}		if (*h)		{			str = malloc(strlen(*e) - 5 + 1 + 1);			if (!str)			{				continue;			}			p = *e + 5;			q = str;			while (*p && (*p != '='))			{				firstLetter = 1;				while (*p && (*p != '=') && (*p != '_'))				{					if (firstLetter)					{						*q++ = *p++;						firstLetter = 0;					}					else					{						*q++ = tolower(*p);						p++;					}				}				if (*p == '_')				{					*q++ = '-';					p++;				}			}			if (*p == '=')			{				p++;				*q++ = ':';				*q++ = ' ';				while (*p)				{					*q++ = *p++;				}				*q = 0;				*r++ = str;				viewReport(app, str);			}		}		e++;	}	str = malloc(6 + strlen(host) + 1);	if (str)	{		strcpy(str, "Host: ");		strcat(str, host);		*r++ = str;		viewReport(app, str);	}	viewReportHTML(app, "<hr>");	*r = NULL;	return (unsigned char **) ret;}