2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

24
HTTP 101 OR, WHAT EXACTLY IS UNDER THE HOOD? Jason Woodward - @jdwcornell TPR1 - #heweb09

Transcript of 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

Page 1: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

HTTP 101OR, WHAT EXACTLY IS UNDER THE HOOD?

Jason Woodward - @jdwcornellTPR1 - #heweb09

Page 2: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

TODAY

• http://heweb09.jdwcornell.com/tpr1.html

• I won’t cover everything!

• First: Lecture

• Second: Live Demos

Page 3: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

FIREFOX ADD-ONS

• FireBug

• Live HTTP Headers

Page 4: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

USER

Page 5: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

USER AGENT

Page 6: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

REQUEST

GET / HTTP/1.1

Page 7: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

HEADERS

Host: www.hotelschool.cornell.eduUser-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5Accept-Language: en-us,en;q=0.5Accept-Encoding: gzip,deflateAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7Keep-Alive: 300Connection: keep-alive

Cookie: __utma=23486248.1379333332.1186101146.1190680468.1191188903.5; __utmz=23486248.1191188903.5.4.utmccn=(referral)|utmcsr=directory.cornell.edu|utmcct=/|utmcmd=referral

Page 8: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

REQUEST + HEADERS

GET / HTTP/1.1Host: www.hotelschool.cornell.eduUser-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5Accept-Language: en-us,en;q=0.5Accept-Encoding: gzip,deflateAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7Keep-Alive: 300Connection: keep-aliveCookie: __utma=23486248.1379333332.1186101146.1190680468.1191188903.5; __utmz=23486248.1191188903.5.4.utmccn=(referral)|utmcsr=directory.cornell.edu|utmcct=/|utmcmd=referral

Page 9: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

SERVER

Page 10: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

RESOURCE

Page 11: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

RESPONSE & HEADERSHTTP/1.1 200 OKDate: Tue, 16 Oct 2007 14:36:15 GMTServer: Apache/2.0.59 (Unix) PHP/5.2.1 mod_ssl/2.0.59 OpenSSL/0.9.7a mod_perl/2.0.3 Perl/v5.8.5X-Powered-By: PHP/5.2.1Last-Modified: Tue, 16 Oct 2007 14:36:15 GMTKeep-Alive: timeout=5, max=100Connection: Keep-AliveTransfer-Encoding: chunkedContent-Type: text/html; charset=utf-8

Page 12: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

STATUS CODE

HTTP/1.1 200 OK

Page 13: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

RENDER

Page 14: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

RINSE, REPEAT

Page 15: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

CREDENTIALS

Page 16: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

SEARCH ENGINE SIGNALING

• HTTP Status Code 301

• “Moved Permanently”

• Signals “there is a new URL for this resource” to the search engine

• HTTP Status Code 302

• “Found”

• Signals “the resource is elsewhere, but only temporarily”

• The “typical” “redirect” used in web applications

Page 17: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

(SOME) CACHE CONTROL

• Expires response header: signals to the user agent the time after which the contents of the response are no longer cacheable.

• Last-Modified response header: signals to the user agent the time the server believes the resource was last updated.

• Cache-control request and response headers: user agent and server can signal to one another whether or not they want cached content or fresh content.

Page 18: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

404 NOT FOUND

• Status 404: Not Found

• The server evaluated the Request URI and cannot find a matching resource. No indication is given on whether or not this is permanent

• Status 410: Gone

• The requested resource is no longer available at the server and no forwarding address is known

Page 19: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

HTTP 101?

10.1.2 101 Switching Protocols

The server understands and is willing to comply with the client's request, via the Upgrade message header field (section 14.42), for a change in the application protocol being used on this connection. The server will switch protocols to those defined by the response's Upgrade header field immediately after the empty line which terminates the 101 response.

The protocol SHOULD be switched only when it is advantageous to do so. For example, switching to a newer version of HTTP is advantageous over older versions, and switching to a real-time, synchronous protocol might be advantageous when delivering resources that use such features.

Page 20: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

REVERSE HTTP

Page 21: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

HEADERS REVISITED

Host: www.hotelschool.cornell.eduUser-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5Accept-Language: en-us,en;q=0.5Accept-Encoding: gzip,deflateAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7Keep-Alive: 300Connection: keep-alive

Cookie: __utma=23486248.1379333332.1186101146.1190680468.1191188903.5; __utmz=23486248.1191188903.5.4.utmccn=(referral)|utmcsr=directory.cornell.edu|utmcct=/|utmcmd=referral

Page 22: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

RESPONSE & HEADERSHTTP/1.1 200 OKDate: Tue, 16 Oct 2007 14:36:15 GMTServer: Apache/2.0.59 (Unix) PHP/5.2.1 mod_ssl/2.0.59 OpenSSL/0.9.7a mod_perl/2.0.3 Perl/v5.8.5X-Powered-By: PHP/5.2.1Last-Modified: Tue, 16 Oct 2007 14:36:15 GMTKeep-Alive: timeout=5, max=100Connection: Keep-AliveTransfer-Encoding: chunkedContent-Type: text/html; charset=utf-8

Page 23: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

• HTTP is stateless

• The RFC defines how compliant servers and clients communicate

KEY REMINDERS

Page 24: 2009.highedweb.org2009.highedweb.org/presentations/tpr1.pdf · Created Date: 10/5/2009 3:58:37 PM

DEMOS

Volunteer with a URL?

Questions?