On the first check I get all correct except error 404. Not sure where to implement that. After implementing Indexes and Load, I tried check50 only to get Unexpected end of input. Not sure how to debug this one. Any suggestion?

I'll provide my code for load and indexes since there wrong. If I'm breaking a rule, please let me know admin.

char* indexes(const char* path)


char* iphp = "/index.php";
char* ihtml = "/index.html";

char* ipc = malloc(strlen(path) + strlen(iphp) + 1 );
char* ihc = malloc(strlen(path) + strlen(ihtml) + 1);

strcpy(ipc, path);
strcpy(ihc, path);
strcat(ipc, iphp);
strcat(ihc, ihtml);
printf("ihc: %s\nipc: %s\n", ihc, ipc);

if (access(ipc, F_OK) == 0){
    return ipc;
else if (access(ihc, F_OK) == 0){
    return ihc;
    return NULL;


bool load(FILE* file, BYTE** content, size_t* length)


if (file == NULL){
    return false;
int counter = 0;
char c;
char* toc = malloc(1);

while( (c = fgetc(file)) != EOF){
    toc[counter] = c;
    toc = realloc(toc,counter + 1);
*length = 0;
*content = toc;
*length = counter;

return true;



Unexpected end of input

Indicates a timeout on the check50 server. It has not processed your request. The only advice is "try again later".

error 404

Assuming you mean the "non_existAnt" file test did not pass, this usually indicates some problem with your abs_path from the parse function. There is no "implementation" for error 404, it "comes with" the distro code.


This line char c; is problematic. Because of internal casting in fgetc, this can return a "false eof", and almost always does on binary (image) files. Some char in the image files is being cast to the int -1. EOF is defined (in stdio.h) as -1. The loop ends prematurely. If you cast c as an int (instead of char), it should work. This article may help clarify the point.

There may be other problems in your functions. Keep testing in a browser/curl and trying check50 until you get a result. And remember, gdb is a valuable tool for troubleshooting server.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .