http 101

Hyper Text Transfer Protocol



Shaikhul Islam Chowdhury

Features

  • URLs
  • VERBs
  • Status Codes
  • Headers
  • Request/Response format
  • Case Study: browsing google.com
  • Connection Handling
  • Authentication
  • Caching

Basics

  • communication between client and server
  • communication takes place over TCP/IP
  • stateless protocol
  • default port 80
  • HTTP/1.1
    • persistent connections
    • chunked transfer-coding
    • fine grained caching headers

URLs

Uniform Resource Locators

verbs

  • GET
  • POST
  • PUT
  • DELETE

                      • HEAD
                      • OPTIONS
                      • TRACE

STATUS CODES

  • 1xx - informal messages
  • 2xx - successful
    • 200 OK
    • 202 ACCEPTED
    • 204 NO CONTENT
  • 3xx - Redirection
    • 301 MOVED PERMANENTLY
    • 303 MOVED TEMPORARILY
  • 4xx - client error
    • 400 BAD REQUEST
    • 401 UNAUTHORISED
    • 403 FORBIDDEN
    • 404 NOT FOUND
    • 405 METHOD NOT ALLOWED
  • 5xx - server error
    • 500 INTERNAL SERVER ERROR
    • 503 SERVICE UNAVAILABLE

HEADERS

  • General headers
  • Request specific headers
  • Response specific headers
  • Entity headers

general headers


entity headers


REQUEST/RESPONSE FORMATS



request format



request format


response format




DISCOVERING GOOGLE.COM


request

response

DISCOVERING GOOGLE.COM

request

response


DISCOVERING GOOGLE.COM


request

response

Connection handling



identification

  • Request headers - From, Referer, User-Agent
  • Client IP
  • Fat URL
  • Cookie: Set-Cookie: session-id=12345;

Basic authentication


secure http


http caching


http caching

Document Expiration - response headers
  • HTTP/1.0 - Age, Expires
  • HTTP/1.1 - Cache-Control=max-age<s>

Cache-Control=no-cache
Cache-Control=no-store
Cache-Control=must-revalidate
Cache-Control=max-age

Server Revalidation -request headers
  • If-Modified Since - Last modified
  • If-None-Match - ETag

References

  • http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
  • http://www.jmarshall.com/easy/http/#http1.1c3
  • http://code.tutsplus.com/tutorials/http-the-protocol-every-web-developer-must-know-part-1--net-31177
  • http://code.tutsplus.com/tutorials/a-beginners-guide-to-http-and-rest--net-16340
  • http://code.tutsplus.com/tutorials/demystifying-rest--pre-58000




thank you


HTTP 101

By Shaikhul Islam

HTTP 101

HTTP 101 every developers must know

  • 658