Thursday, 4 September 2014


Today we are going to learn about URI and HTTP

Uniform Resource Identifier:

A Uniform Resource Locator (URL) is used to address  a document on the Web.
• The name that corresponds to an IP address in the DNS is known as a URL
• A full Web address is like:
– http://www.scss.tcd.ie/Owen.Conlan/php/xpath/index.html
• A URL usually follows these syntax rules:
– scheme://host.domain.country_code:port/path/filename
Retrieving a URL
TCP/IP is a collection of communication protocols that controls the way that information is broken up and posted over the Internet.
HTTP takes care of the communication between a web server and a web browser.
• To retrieve a Web resource, the user either specifies a URL in the Web browser’s address or clicks on a hyperlink <a> in a document.
HTTP is used for sending requests from a web client (a browser) to a web server, returning web content (web pages) from the server back to the client.
• The Web browser specifies the details of the required Web page in a HTTP Request message
• The Web server receives this request and after processing it completes the operation by returning either the document or an error in the HTTP Response message.

HTTP (HyperText  Transfer Protocol):

It is one of the Application Layer Protocol.  How do applications interact with each over a network or the internet?
Example:
HTTP(S)                          Websites and Documents
FTP                                  Files
SMTP,POP,IMAP            E-Mail

HTTP is a protocol for distributed hypertext and hypermedia. Used by Web Client (browser) and Web Server to communicate.

http request Details

HTTP REQUEST

Message indicating the client wants to a piece of hypertext or hypermedia from the server

                                                                  /*header
POST /Login.php HTTP/1.1!                 //REQUEST TYPE(POST)
Host: www.website.com!
User-Agent: Mozilla/5.0 !                      *  header
Content-Length: 27!                                 *header
Content-Type: application/x-www-form-urlencoded      */
userid=joe&password=guessm!             //body   



REQUEST TYPE:

·         GET: Received document on URL"
·         POST: Send information to server on URL"
·         PUT: Replace document on URL"
·          DELETE: Remove document on URL"
·          HEAD: Received headers from document on URL"
·         OPTIONS: Request options for this server"
REQUEST HEADER:
Content Length: the length of the content
User-Agent: Sending application
Date: Date J
Host*: Receiver.
 Others…

HTTP RESPONSE:

HTTP/1.1 200 OK!  //Response Code
Date: Thu, 08 Apr 2004 18:24:33 GMT!    /*
Server: Apache/1.3.29 (Unix) PHP/4.3.4!  *
X-Powered-By: PHP/4.3.4!                 *
Content-Language: nl!                    *
Content-Type: text/html;                 * header
charset=iso-8859-1!                      *
X-Cache: MISS from wikipedia.org!        *
Connection: close!                       *
Content-Length: 49!                      */
<html><head></head><body></body></html> //body
RESPONSE CODE!
 1xx: informal message by server"
 2xx: successful HTTP request"
 3xx: redirection"
 4xx: client error in HTTP request"
 5xx: server error"
 6xx: proxy error"
MOST COMMON!
 401 (unauthorized)
 400 (bad request)
 403 (forbidden)
 404 (not found)
 500(internal server error)

RESPONSE HEADER:
Content Length: the length of the content
 Content Type: type of content
 Server: Type of server
 Date: Date
 Host*: Receiver.
 Others…

 Hope, you will understand the HTTP protocol and its role on the internet.

Stay tuned for next discussion on HTML.

No comments:

Post a Comment