I got stuck a while back on
load, put this pset down, moved on to complete (and thoroughly enjoy) pset7, but I don't like that I didn't finish this one.
Here's what is happening: when I start the server and click on an
.html file, it downloads rather than opens directly. When I open one in Chrome, I see close to accurate code except in the case where I open a page with shorter code after one with longer code. Also,
cat.jpg doesn't display (probably because I have extra bytes at the end).
I feel like I am so close, but I am struggling to get my memory allocation just right. Below is what I have for
load. Any tips would be greatly appreciated. I really want to figure this out and move on to mashup to finish up the psets. Thanks!
Original code removed - Please see revision below
Per academic honesty, correct load code removed
I added the printf as a sanity check, and this is what I see in the terminal:
GET /hello.html HTTP/1.1 <!DOCTYPE html> <html> <head> <title>hello</title> </head> <body> <form action="hello.php" method="get"> <input autocomplete="off" autofocus name="name" placeholder="Name" type="text"/> <input type="submit" value="Say Hello"/> </form> </body> </html> HTTP/1.1 200 OK GET /cat.html HTTP/1.1 <!DOCTYPE html> <html> <head> <title>Happy Cat</title> </head> <body> <img alt="Happy Cat" src="cat.jpg"/> </body> </html> HTTP/1.1 200 OK
The HTML looks okay. The longer code is not appended to the shorter code, but it's still not showing
cat.jpg and all the files are downloading rather than displaying properly.