1

There's a couple of problems. debug50 and gdb would be very helpful in troubleshooting and debugging server. The backtrace errors are seg faults that are coming from the indexes function. This temp = strchr(line,((char)63)+1); looks like a problem. It is asking strchr to find '@' (ascii 64) in line. Since it doesn't find '@', temp is NULL and program gives a ...


1

Some guidelines. Look at this: char* inx = malloc(sizeof (strlen(path) + strlen(ind_html) + 1)); This entire expression is an int: (strlen(path) + strlen(ind_html) + 1) Can you tell what is the sizeof an int? And as a side note: You don't need the slash / here: char* ind_php = "/index.php"; char* ind_html = "/index.html"; You can use just "index.php" ...


1

I've changed load function now it looks like this: load bool load(FILE* file, BYTE** content, size_t* length) { // TODO BYTE* buffer = NULL; size_t count_length = 0; int character = 0; //allocating memory for buffer buffer = malloc(sizeof(BYTE)); while((character = fgetc(file)) != EOF) { buffer[count_length] = (char)...


1

I can tell you one problem right away. This part won't work with pipe streams like php files: //get the length of file in bytes fseek(file, 0, SEEK_END); byte_length = ftell(file); fseek(file, 0, SEEK_SET); To get the load() function working correctly 100% of the time, one usually needs to read from the stream progressively and use realloc() ...


1

Yes, debugging server is challenging. It takes patience, practice and perseverance. You will find intro material for debug50 here, and some tips on gdb here. It is really worth the investment of time. I have found it easier to debug with curl requests instead of browser requests. The main thing to remember is: if server is not doing anything, it is probably ...


Only top voted, non community-wiki answers of a minimum length are eligible