A problem of my web server
I have written a C progam to implement a web server.When I use the execle() function to implement CGI,the system tell me : Bad Adress.
My program can reslove cgi path ,cgi para,cgi name and some environment variables,for example:
char *cgiPath;
char *cgiName;
char *cgiPara;
char *envp[6];
cgiPath = "./cgi-bin/vote.pl";
cgiPara = "idol=B";
cgiName = "vote.pl";
envp[0] = "REQUEST_METHOD=POST";
envp[1] = "CONTENT_LENGTH=6";
envp[2] = "CONTENT_TYPE=application/x-www-form-urlencoded"
...
I call execle like this:
if (execle(cgiPath,cgiName,(char *)0,envp) = -1)
perror("execle error");
When this function is executed,an error occur:Bad adress.
then what's wrong?
|