WebFund 2016W: Assignment 2
In this assignment you will be be extending the functionality of tinywebserver.js from Tutorial 2. There are ?? points in ?? questions. This assignment is due on January 27, 2016.
Questions
- [4] Explain how and why the behavior of tinywebserver changes when you delete the following lines:
- Line 50: 'html': 'text/html',
- Line 64: docroot: '.'
- Line 95: return response.end();
- Line 126: requestpath += options.index;
- [1] Who calls exists_callback() defined on lines 115-121? When is this call made?
- [1] What does the path.join() call do on line 139? Why call this method rather than implenting this functionality inline?
- [1] When serve_file() returns, what work has it accomplished? Specifically what data (if any) has been returned to the requesting web client? Why?
- [1] What is the purpose of the code on lines 150-156 (the else clause of the "err != null" if test)?
- [1] How can you access the incoming HTTP request headers in tinywebserver?
- [1] Which part of tinywebserver would you change to add a new HTTP response header?
- [BONUS 1] What do you find most confusing about the material covered so far in COMP 2406? Note you do NOT get a bonus mark for saying "nothing"!