blog.chaker.tn

mail@chaker.tn

@chakerbenhamed

 

The Cool protocol

HTTP

Text

Hyper

Transfer

Protocol

HTTP

The foundation of data communication for the World Wide Web

HTTP & HTML

HTMLHyperText

Definitions of tags that are added to Web documents to control their appearance

The rules governing the conversation between a Web client and a Web server

HTTPHyperText Transfer

Protocol

Markup Language

Both were invented by the same person at the same time

Tim Berners-Lee

URL

http://cllfst.org.tn

scheme/protocol

Domain

Uniform Resource Locator

http://www.chaker.tn/CLLFST/get.php?club=CLL&year=2015

protocol

sub-domain

domain

TLD

File path

query string

How it woks

Request–response

Example of HTTP Request

GET /get?club=CLL&year=2015 HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: httpbin.org
User-Agent: HTTPie/0.9.2

Example of HTTP Response

HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 289
Content-Type: application/json
Date: Tue, 20 Oct 2015 22:25:52 GMT
Server: nginx

{
    "args": {
        "club": "CLL", 
        "year": "2015"
    }, 
}

HTTP methods

  • GET
  • PUT
  • HEAD
  • POST
  • DELETE
  • OPTIONS
  • TRACE
  • CONNECT

GET

The GET method requests a representation of the specified resource. Requests using GET should only retrieve data and should have no other effect.

http://www.chaker.tn/CLLFST/get.php?club=CLL&year=2015

HEAD

The HEAD method asks for a response identical to that of a GET request, but without the response body.

POST

Requests that a web server accepts and stores the data enclosed in the body of the request message

HTTP Headers

Accept

Content-Types that are acceptable for the response

Accept: text/plain
Accept-Charset

Content-Types that are acceptable for the response

Accept-Charset: utf-8
Cookie

An HTTP cookie previously sent by the server

Accept: text/plain
Content-Length

The length of the request body in octets

Content-Length: 348
Host

The domain name of the server

Host: cllfst.org.tn
User-Agent

The user agent string of the user agent

User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20100101 Firefox/21.0
Server

A name for the server

Server: Apache/2.4.10 (Ubuntu)
Set-Cookie
Set-Cookie: UserID=JohnDoe; Max-Age=3600; Version=1
Content-Type

The media type of this content

Content-Type: text/html
Content-Length

The length of the response body in octets

Content-Length: 348
Location

Used in redirection, or when a new resource has been created.

Location: http://cllfst.tn

Status codes

HTTPCLLFST

By Chaker ben hamed

HTTPCLLFST

  • 468