I am pretty sure my other functions work - I pass all check50, except for the last line in check50 server1, where it's written TODO and the same for check50 server2.
However, when I ran server in IDE, as an output I get only lines of code. It's similar to "view page source" option. And an error in connection. Unfortunately, I cannot access the IDE now to copy at least a snippet of that output.
Thanks!
char* indexes(const char* path)
{
char* ind_php = "/index.php";
char* ind_html = "/index.html";
char* inx = malloc(sizeof(strlen(path) + strlen(ind_html) + 1));
strcpy(inx, path);
strcat(inx, ind_html);
if (access(inx, F_OK))
{
return inx;
}
strcpy(inx, path);
strcat(inx, ind_php);
if (access(inx, F_OK))
{
return inx;
}
free(inx);
return NULL;
}
EDIT. Do not use F_OK, but R_OK. Also, if access != -1. :) HTH.