Monday, April 29, 2019

Lecture 0 - Part2 "HTTP" - Building Dynamic Websites CS75

Harvard OpenCourseWare. (Summer 2012)

Lecture 0 "HTTP" - Building Dynamic Websites - Part2


Summary: This is the first lecture of the series. Building Dynamic Websites by Harvard OpenCourseWare with Great Instructor David J. Malan


The real meat of Lecture #0 starts at 1:18:00.




Course Web Site by CS75.tv
Course Sillabus (Opens in a PDF)

Course Sections Lead By TA
Course Projects
The course's own website is at www.cs75.net.
Google Discussion Group



Lecture #0 Summary

Part-1
  1. http protocol
  2. Look at the http header
  3. How "internet" find the host, e.g. google.com, specified in a URL
  4. How query parameter in a URL is passed
  5. DHCP
  6. Connecting to a remote host via telnet with IP address

Part-2
  1. GET / HTTP/1.1 command in telnet
  2. HTTP/1.1 400 bad request
  3. HTTP/1.1 Error 301 - Moved permanently
  4. dhcp commad
  5. dhcp nslookup cnn.com and check the IP address
  6. /private/etc/hosts file for host database that lists 127.0.0.1 for localhost
  7. Use Chrome advanced feature for a developer to inspect the HTML element for style (button length)


0.2 Let's look at the HTTP header


0.2.1 Simple Front-End Demo By "Google Search"










=================================
Source Code for front-end
=================================
<!DOCTYPE html>

<html>

  <head>
    <title>Google</title>
  </head>
  <body>
    <div style="text-align: center">
      <h1>Google</h1>
      <form action="http://www.google.com/search" method="get">
        <input name="q" style="width: 300px" type="text">
        <br>
        <input type="submit" value="Google Search">
        <input type="submit" value="I'm Feeling Lucky">
      </form>
    </div>
  </body>
</html>


0.2.2 Let's Look At HTTP Traffic

Open the Chrome developer tool as shown below.



HTTP GET Request Headers









By default telnet uses TCP port#21.
Below, telnet is specified to use the TCP port#80.

Here on the last command, pretend being a browser and send "GET /  HTTP/1.1".






The server responded with a "400 Bad Request", because pretended being a browser, but did not send a browser header. (A browser header was missing in the HTTP request manually sent from telnet.)


Host: harvard.edu
Server sent an error code 301 - Permanent redirect



























MIT 6.00 コンピュータサイエンスとプログラミング秋期講座第2回

  MIT 6.00 コンピュータサイエンスとプログラミング秋期講座第2回 オープンコースウエア 大学名:MIT 講座名:6.00 Introduction to Computer Science and Programming Download course material ...