HTTP

Author: Tran Tuan Quy

Date: Jul 7, 2014



Forever and  One

HTTP

How HTTP work

HTTP Message

HTTP in use

GENERAL concept

HyperText Transfer Protocol

Current version: 1.1

Next Version: 2.0
http://http2.github.io/http2-spec/index.html

Use TCP, not UDP

HTTP 1.1


  • Charset
    • ASCII, ANSI, ISO-8859-1, UTF-8

  • Date/Time:
Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822

  • Content-Coding:
    • gzip
    • compress
    • deflate
    • identify

How web communiCation WORK


HTTP server

HTTP client

how client talk with server



     Open http://plus.google.com/
  1. Client make TCP connection to 173.194.127.160
  2. Client send HTTP request message to server
  3. Client read HTTP response returned from server
  4. Client close TCP connection

how client talk with server

how client talk with server

HTTP Message

Two types: HTTP Request or HTTP Response

HTTP REquest


HTTP Request Method


GET

POST

PUT

DELETE

HEAD

OPTIONS

TRACE

CONNECT

HTTP REQUEST header

Host

Content-Type

Cookies

Expires

User-Agent
Authorization

list of message-header definitions

REQUEST BODY


user:abc@gmail.com&pass=123456

          

                                  Related Header:

Content-Length: 202

Content-Encoding: gzip | compress

HTTP RESPONSE

 

STatus code


1xx: Informational:

  • 100 Continue
  • 101 Switch protocol

2xx: Successful

  • 200 OK
  • 201 Created

3xx: Redirection

  • 301 Moved Permanently
  • 304 Not Modified
 

STatus code


4xx: Client Error

  • 400 Bad Request
  • 401 Unauthorized

5xx: Server Error

  • 500 Internal Server Error
  • 501 Not Implemented


http REsponse header

Content-Type

Content-Length

Content-Encoding

Set-Cookies

Server


list of message-header definitions

HTTP in Use

HOW web server manage session

WHAT happen when HTTMl form is submitted

POST form data with jquery.ajax


See the Pen ajax with jquery by quy tran (@tuanquynet) on CodePen.

some sort of USER authentication


Basic Access Authentication

Digest Authentication

JSON Web Token (JWT)

THanks

HTTP

By Quy Tran

Loading comments...

More from Quy Tran