|
home—lects—hws
D2L—breeze (snow day)
Review: show the result of requesting hello.php: the server, seeing the suffix “.php”, is configured (presumably) to run that file as a php program, and whatever that program prints is what the server sends back to the client.
SO: when our browser visits on hello.php, and we do a show-source, do we see the php program? NO! (Why not? Let's reread the above paragraph!)
I happened to take that php file, and make a copy which I (mis)named as “hello.html”. Now, the server isn't running it (since the server doesn't see any “.php” suffix), we are are being served up the file contents directly. It looks funky; do a show-source and then tell me why the client is displaying the source-code in a very odd way.
Seeing the show-source of hello.html, we can now tell what originally went on when we requested hello.php.
Task:
the function
For any programming task (from 120 on up, including web programming), we start with test cases, which are runnable code:
echo "actual: ", blend("motor", "hotel"), "\n"; echo "expect: ", "motel", "\n"; echo "actual: ", blend("smoke", "fog"), "\n"; echo "expect: ", "smog", "\n"; |
So, let's make some further test cases.
What should
What should
We'll continue next time: What other inputs should we test?
1Or if the requested resource was (say) in image-file, the http packet's payload would be the bits of the image-file. The payload is actually reponsible for includeing a “mime-type” statement to help the receiver understand how the payload's bits should be interpreted, but it's forgivable to think of the payload as just being the bits all the other meta-information as part of some-header-or-another, w/o worrying to distinguish http header info from other headers. ↩
2 For example, see www.montgomerycollege.edu/~steuben/blendwords.htm. ↩
3Okay, okay, here's the third component right now: A way to automatically compare the actual and expected outputs, so that we don't rely on having to manually scour output with a human eye. ↩
home—lects—hws
D2L—breeze (snow day)
©2015, Ian Barland, Radford University Last modified 2016.Feb.02 (Tue) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |