I have implemented server up to the point of respond to client. When I make a request for static content from Chrome, I get this:
GET /cat.html HTTP/1.1 THE QUERY IS THE ABSOLUTE PATH IS /cat.html THE PATH IS /home/jharvard/Dropbox/pset6/public/cat.html THE EXTENSION SIZE IS 5 THE EXTENSION IS html HTTP/1.1 200 OK GET /cat.html HTTP/1.1 HTTP/1.1 400 Bad Request THE QUERY IS Segmentation fault (core dumped) GDB:
Program received signal SIGSEGV, Segmentation fault. 0x08049719 in main (argc=4, argv=0xbffff194) at server.c:332 warning: Source file is more recent than executable. 332 printf("THE PATH IS %s\n", path); The first loop works great but then it loops again without truly resetting everything, I think. Why does it work the first time and then repeat? Is it because I have not implemented the last piece of the pset?
int lineLength = strlen(line); int spaces = 0; char* requestStart = NULL; // position after first ' ' char* httpVersionStart = NULL; // position after second ' ' char* queryStart = NULL; // position after (?) bool validReqTargetPath; bool validReqTargetFile; bool validReqTargetString = true; [code is hidden behind the edit flag so it remains out of view of casual viewers of the page]
gdbwarns you that your source code file is more recent than the executable. that means that you updated your source code and forgot to compile. re-compile your code and try again withgdb. notice that it tells you the line number of cause of the segfault. that should give some clues.