WebFund 2016W: Assignment 2

From Soma-notes
Revision as of 21:17, 18 January 2016 by Soma (talk | contribs) (Created page with "In this assignment you will be be extending the functionality of tinywebserver.js from Tutorial 2. There are ?? points in ?? questions. This as...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

  1. [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;
  2. [1] Who calls exists_callback() defined on lines 115-121? When is this call made?
  3. [1] What does the path.join() call do on line 139? Why call this method rather than implenting this functionality inline?
  4. [1] When serve_file() returns, what work has it accomplished? Specifically what data (if any) has been returned to the requesting web client? Why?
  5. [1] What is the purpose of the code on lines 150-156 (the else clause of the "err != null" if test)?
  6. [1] How can you access the incoming HTTP request headers in tinywebserver?
  7. [1] Which part of tinywebserver would you change to add a new HTTP response header?
  8. [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"!