I've managed to pass the first check50 with all green, and I think there is nothing wrong with my load function, but my pages don't load when I click on the link.

This happens with every link except php, in which I get " 500 internal server error"

From gdb I know that abs_path and query are being written corrected in parse, and the load function seems to load each byte correctly.


Some help to point me in the right direction would be really useful.

  • Pointer load: Inspect the value of length when you return to main from load. Pointer php: Take this loop if(strchr(path,'?') != NULL) for a spin in gdb. Jul 11 '16 at 11:43
  • Thank you, I get weird strings now: "ÿA/home/ubuntu/workspace/pset6/public/cat.html±" Jul 11 '16 at 13:44
  • Where do you get those "weird strings"? Jul 11 '16 at 13:50
  • When I click on any of the links,that appeears instead of the happy cat image. except php's, I still get error 500 on them. Jul 11 '16 at 13:52
  • Use gdb and set a break in the do loop in load where you increment i. Jul 11 '16 at 15:21

After a lot of help from DinoCoderSaurus, I have finally figured out what was wrong with my code.

First of all, I wasn't incrementing length properly in load.

Then I wasn't returning anything when there was no query.

Also, the load function had a problem. I was storing a lot of EOF's at the end of my string.

The most important problem was scope. A couple of times everything was correct but I wasn't storing the information where the pointer was pointing. For example, instead of doing this:

query = qery;

I should have done this:

strcpy(query, qery);

Because it actually stores "qery" in the address pointed to by query (*query).

Hope this helps someone:)

You must log in to answer this question.

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