WebFund 2015W: Assignment 9: Difference between revisions

From Soma-notes
No edit summary
Line 16: Line 16:


===GET /===
===GET /===
<pre>
> 2015/04/05 13:06:41.964459  length=406 from=0 to=405
GET / HTTP/1.1\r
Host: localhost:3005\r
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0\r
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r
Accept-Language: en-US,en;q=0.5\r
Accept-Encoding: gzip, deflate\r
DNT: 1\r
Cookie: connect.sid=s%3A7VfppM1sNSPZH2ItZKhGrNFwEYtZ9hqe.j39zaf1VaOxBtKb48jUl%2BrxDauYO3IQSu%2BMaNlQgBz8\r
Connection: keep-alive\r
\r
< 2015/04/05 13:06:41.984748  length=188 from=0 to=187
HTTP/1.1 200 OK\r
X-Powered-By: Express\r
Content-Type: text/html; charset=utf-8\r
Content-Length: 588\r
ETag: W/"24c-32554b76"\r
Date: Sun, 05 Apr 2015 17:06:41 GMT\r
Connection: keep-alive\r
\r
< 2015/04/05 13:06:41.985227  length=587 from=188 to=774
<!DOCTYPE html>
<html>
  <head>
    <title>COMP 2406 AJAX Notes Demo</title>
    <link rel="stylesheet" href="/stylesheets/style.css">
    <script src="/javascripts/jquery-1.11.2.js"></script>
  </head>
  <body>
    <h1>COMP 2406 AJAX Notes Demo</h1>
    <p>Welcome to COMP 2406 AJAX Notes Demo</p>
    <p>Please log in</p>
    <div>
      <form action="/login" method="post">
        <div>
          <input type="text" name="username">
          <label for="username">Username</label>
        </div>
        <button type="submit">Login</button>
      </form>
    </div>
  </body>
</html< 2015/04/05 13:06:41.986483  length=1 from=775 to=775
>
</pre>
===GET /javascripts/notes.js===
===GET /javascripts/notes.js===
===GET /getNotes===
===GET /getNotes===
===POST /updateNote===
===POST /updateNote===
===POST /newNote===
===POST /newNote===

Revision as of 17:12, 5 April 2015

This assignment has 15 points. For each of the following five HTTP GET and POST requests:

  • give a transcript of the HTTP request going out and the response returned by the ajax-notes server, as CAPTURED BY YOU using socat as discussed in Tutorial 9 (1 point),
  • briefly explain how the browser made this request (did the user type an address in the URL bar or did they interact with a page, and if they interacted with a page how did that page generate that HTTP request) (1 point), and
  • briefly explain what code the server ran to generate the response. (1 point)

In other words, you should be giving an HTTP request example and then explaining the browser context that generated the request and the server context that generated the response.

Submit your answers on cuLearn in a text or PDF file by 10 AM on Monday, March 30, 2015. No other formats will be accepted.

  1. GET /
  2. GET /javascripts/notes.js
  3. GET /getNotes
  4. POST /updateNote
  5. POST /newNote

Solutions

GET /

> 2015/04/05 13:06:41.964459  length=406 from=0 to=405
GET / HTTP/1.1\r
Host: localhost:3005\r
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0\r
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r
Accept-Language: en-US,en;q=0.5\r
Accept-Encoding: gzip, deflate\r
DNT: 1\r
Cookie: connect.sid=s%3A7VfppM1sNSPZH2ItZKhGrNFwEYtZ9hqe.j39zaf1VaOxBtKb48jUl%2BrxDauYO3IQSu%2BMaNlQgBz8\r
Connection: keep-alive\r
\r
< 2015/04/05 13:06:41.984748  length=188 from=0 to=187
HTTP/1.1 200 OK\r
X-Powered-By: Express\r
Content-Type: text/html; charset=utf-8\r
Content-Length: 588\r
ETag: W/"24c-32554b76"\r
Date: Sun, 05 Apr 2015 17:06:41 GMT\r
Connection: keep-alive\r
\r
< 2015/04/05 13:06:41.985227  length=587 from=188 to=774
<!DOCTYPE html>
<html>
  <head>
    <title>COMP 2406 AJAX Notes Demo</title>
    <link rel="stylesheet" href="/stylesheets/style.css">
    <script src="/javascripts/jquery-1.11.2.js"></script>
  </head>
  <body>
    <h1>COMP 2406 AJAX Notes Demo</h1>
    <p>Welcome to COMP 2406 AJAX Notes Demo</p>
    <p>Please log in</p>
    <div>
      <form action="/login" method="post">
        <div>
          <input type="text" name="username">
          <label for="username">Username</label>
        </div>
        <button type="submit">Login</button>
      </form>
    </div>
  </body>
</html< 2015/04/05 13:06:41.986483  length=1 from=775 to=775
>

GET /javascripts/notes.js

GET /getNotes

POST /updateNote

POST /newNote