Introduction to HTTP

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    3 Favorites

    Introduction to HTTP - Presentation Transcript

    1. Allagappan M Emerging Markets
    2. What were they thinking when they designed Internet?
    3. Distribute (content) & Link were the keywords
    4. What is it today? Ajaxy Web
    5. It is a application development framework now.
    6. Get basics right: What is the difference between Internet and WWW?
    7. Internet ≅ TCP/IP Layer (Transport + Network Layer ) WWW ≅ HTTP + HTML (Application Layer) Web = Linked document
    8. How internet works.
    9. How HTTP Works.
    10. Properties of HTTP Persistent Connections Session state Methods Status codes
    11. Persistent connections
    12. Non persistent connections (HTTP/1.0) Lookup what CSS/JS/IMG should be fetched Open TCP GET /style.css Close TCP Open TCP GET /logo.jpg Close TCP Open TCP GET /script.js Close TCP
    13. Persistent Connections (HTTP/1.1)
    14. Session state
    15. Stateless-ness
      • Every subsequent visit via HTTP is same as the first visit.
      • Unlike SSH & FTP, HTTP works with a single TCP Connection which is used *only* for content transfer, and no additional connection is used to maintain sessions.
      • Cookies, Session IDs are alternative ways of maintaining sessions.
      • Statelessness = simplicity.
    16. HTTP Methods
    17. Understand HTTP request/response content before getting into methods.
    18. GET /index.html HTTP/1.1 Host: example.com Referer: search.yahoo.com HTTP/1.1 200 OK Date: Wed, 28 Jan 2009 19:32:18 GMT Server: Apache/2.2.3 (CentOS) Content-Length: 438 Connection: close Content-Type: text/html; charset=UTF-8 <HTML> <HEAD> <TITLE>Example Web Page</TITLE> </HEAD> <BODY> …… … .. Request Line Method + Resource Request Headers Response Line Statuscode Response Headers Response Body Request Response
    19. HTTP Methods are verbs/actions acting on nouns/resources
      • GET nice_image
      • DELETE the_internet
      • POST my_new_email
      • GET /index.html (the actual stuff)
    20. HTTP Methods
      • GET
      • POST
      • PUT
      • DELETE
      • TRACE
      • OPTIONS
      • CONNECT
      • HEAD
    21. GET
      • Get any resource. Do not change the state of the server.
      • GET method is used:
        • when you click a link on any site.
        • when you bookmark any link and click it
        • when crawlers/robots crawl your site
        • Most of the cases when you want to fetch a document
      • GET requests are the ones which are cached (more on this later)
    22. GET Methods can pass variables.
      • in the url itself.
      • /index.php?page=about&name=vikas
    23. GET is Idempotent
      • Which means, how many ever times you hit the same resource, it should produce the same effect.
      • Getting /index.html any number of times should (ideally) give the same effect.
    24. POST
      • Modify (Append) information in the server.
      • POST Changes the state of the server
      • POST is used
        • when you login into a site
        • when you comment, add blog entry
        • when you change twiki contents
        • (essentially) when you post/submit a form
    25. When you post a comment to a site, you are changing the state of the server. That is what POST method is supposed to do.
    26. POST can has pass variables
      • in the request body
      • where is the request body now?
    27. POST /index.html HTTP/1.1 Host: example.com first_name=sheldon&last_name=cooper HTTP/1.1 200 OK Date: Wed, 28 Jan 2009 19:32:18 GMT Server: Apache/2.2.3 (CentOS) Content-Length: 438 Connection: close Content-Type: text/html; charset=UTF-8 <HTML> <HEAD> <TITLE>Example Web Page</TITLE> </HEAD> <BODY> …… … .. POST Variables in request body
    28. Browsers (HTML) support only GET and POST In the php land, you can use $_GET and $_POST to access those variables.
    29. The least used methods
      • HEAD – Just get me the response headers
      • PUT – Create a new resource
      • DELETE – Delete the resource
      • TRACE – Get me back my request headers, after modifications done by intermediate servers.
      • OPTIONS – Gives back what all HTTP methods the server supports.
    30. Statuscodes
      • 1XX Informational
        • 100 – Continue (Special Case)
      • 2XX Success
        • 200 – Success
      • 3XX Redirection
        • 301 – Moved Permanently (never hit me again)
        • 302 – Found (temporary redirect)
        • 304 – Not Modified – go ahead and use cached data
      • 5XX Server Error
        • 500 – Internal Server Error
    31. 4XX – Client Errors 400 Bad Request http://www.flickr.com/photos/apelad/sets/72157594388426362/
    32. 4XX – Client Errors 401 Not Authorized http://www.flickr.com/photos/apelad/sets/72157594388426362/
    33. 4XX – Client Errors 402 Payment required http://www.flickr.com/photos/apelad/sets/72157594388426362/
    34. 4XX – Client Errors 404 Not Found http://www.flickr.com/photos/apelad/sets/72157594388426362/
    35. 4XX – Client Errors 405 Method not allowed http://www.flickr.com/photos/apelad/sets/72157594388426362/
    36. 4XX – Client Errors 408 Request timed out http://www.flickr.com/photos/apelad/sets/72157594388426362/
    37. 4XX – Client Errors 411 Length Required http://www.flickr.com/photos/apelad/sets/72157594388426362/detail/
    38. Important Request Headers
      • Accept : text/html (Acceptable mime formats)
      • Referer : example.com (Which page lead to this page)
      • User-Agent : Firefox/Safari (Type of browser)
      • Host : yahoo.com (Domain name, reqd for 1.1)
      • Connection : close/keep-alive
      • Date : 12 th Sep 1996 (When the req was sent)
    39. Important Response Headers
      • Content-type : text/html
      • Content-Encoding : utf8 (Encoding type)
      • Content-Length : Length in bytes
      • Server : Apache/IIS (Name of the server, like user-agent)
      • Location : new-site.com (For redirection)
      Most of other important headers are part of Cookie and Cache modifiers
    40. Cookies and HTTP Caching is a very big topic. I’m going to cover from 40,000 ft above.
    41. Cookies help servers to store and retrieve state of the client. If I log into a site, the server issues me cookie, which is stored in the browser.
    42. The next time I request the page, I send the cookie which the server gave me. This time, the server will understand who I am. (You are the guy, whom I gave ‘@#’ cookie – here is your email)
    43. Cookies Yes No Next request Server does a Set-Cookie
    44. HTTP Caching
      • This topic is big enough to be covered in a separate session
      • One of the most misunderstood topic
      • Super hot research topic
    45. HTTP allows 3 ways to control cache Freshness, Validation and Invalidation
    46. Freshness By setting a value for the Expires: header, the browser will get to know till when the content is fresh. Expires:
    47. Validation Use of cached/uncached data with a condition
    48. Checking with last modified time. Last-Modified: If-Modified-Since:
    49. Entity Tags ETag: If-None-Match:
    50. Thanks! http://twitter.com/alagu
    SlideShare Zeitgeist 2009

    + Alagu MAlagu M Nominate

    custom

    773 views, 3 favs, 1 embeds more stats

    Introduction to HTTP

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 773
      • 769 on SlideShare
      • 4 from embeds
    • Comments 0
    • Favorites 3
    • Downloads 68
    Most viewed embeds
    • 4 views on http://www.techiegyan.com

    more

    All embeds
    • 4 views on http://www.techiegyan.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories