WebFund 2016W: Assignment 2: Difference between revisions

From Soma-notes
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..."
 
No edit summary
Line 1: Line 1:
In this assignment you will be be extending the functionality of tinywebserver.js from [[WebFund 2016W: Tutorial 2|Tutorial 2]].  There are ?? points in ?? questions.  This assignment is due on January 27, 2016.
'''This assignment is not yet finalized.'''
 
In this assignment you will be be extending the functionality of tinywebserver.js from [[WebFund 2016W: Tutorial 2|Tutorial 2]].  There are ?? points in ?? tasks.  This assignment is due on January 27, 2016.


<!-- Please submit your answers as a single text or PDF file called "<username>-comp2406-assign3.txt" or "<username>-comp2406-assign3.pdf", where username is your MyCarletonOne username.  The first four lines of this file should be "COMP 2406 Assignment 3", your name, student number, and the date.  You may wish to format answers.txt in [http://en.wikipedia.org/wiki/Markdown Markdown] to improve its appearance.  If you do so, you may convert your text file to PDF using [http://johnmacfarlane.net/pandoc/ pandoc].
<!-- Please submit your answers as a single text or PDF file called "<username>-comp2406-assign3.txt" or "<username>-comp2406-assign3.pdf", where username is your MyCarletonOne username.  The first four lines of this file should be "COMP 2406 Assignment 3", your name, student number, and the date.  You may wish to format answers.txt in [http://en.wikipedia.org/wiki/Markdown Markdown] to improve its appearance.  If you do so, you may convert your text file to PDF using [http://johnmacfarlane.net/pandoc/ pandoc].
Line 6: Line 8:
-->
-->


==Questions==
Your modified version of tinywebserver.js should have the following functionality:
 
# startup option -headers that has a comma-separated list of headers that should be logged on the console for each incoming request.
# [4] Explain how '''and why''' the behavior of tinywebserver changes when you delete the following lines:
# A configuration file <tt>tinyweb.cfg</tt> that allows for the port, document root directory, document aliases, and a custom 404 document.
#* Line 50: <tt>'html': 'text/html',</tt>
# A new 777 status code if there is a request for any document with the word "lucky" in its URL (path or document name).
#* Line 64: <tt>docroot: '.'</tt>
#* Line 95: <tt>return response.end();</tt>
#* Line 126: <tt>requestpath += options.index;</tt>
# [1] Who calls exists_callback() defined on lines 115-121?  When is this call made?
# [1] What does the <tt>path.join()</tt> 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"!

Revision as of 01:31, 19 January 2016

This assignment is not yet finalized.

In this assignment you will be be extending the functionality of tinywebserver.js from Tutorial 2. There are ?? points in ?? tasks. This assignment is due on January 27, 2016.


Your modified version of tinywebserver.js should have the following functionality:

  1. startup option -headers that has a comma-separated list of headers that should be logged on the console for each incoming request.
  2. A configuration file tinyweb.cfg that allows for the port, document root directory, document aliases, and a custom 404 document.
  3. A new 777 status code if there is a request for any document with the word "lucky" in its URL (path or document name).