HTTP Definition and Basics.


Published on

Published in: Internet, Technology, Design
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

HTTP Definition and Basics.

  2. 2. Definition ● An application protocol used to communicate/deliver data on The WWW. ● The protocol to ‘transfer’ hypertexts. ● Stateless request/response protocol. ● Exchanges messages over a session layer or a connection. ● Uses port 80,8008, and 8080.
  3. 3. HTTP Roles ● HTTP Client: A program that establishes a connection with a server for the purpose of sending an HTTP request. ● HTTP Server: A program that accepts a connection to provide service for the HTTP request by sending HTTP response. ● The same program can either be a client or a server, depending on what is it doing.
  4. 4. HTTP Exchange/Transaction A HTTP client establishes a connection with a HTTP server and sends the server HTTP request, the server returns HTTP response. When the response is received, the connection is terminated.
  5. 5. Request/Response Message Format ● Initial line ( request/response) ● header line ( or none) ● blank line -> to indicate the ending of header section ● message body ( data payload), optional section.
  6. 6. Initial Line | HTTP Request Format HTTP request has 3 sections separated by a space. ● HTTP method name ● URL host path ● HTTP protocol version GET /path/to/file/index.html HTTP/1.1 Note: HTTP protocol always takes this format HTTP/ x.x
  7. 7. Initial line | Response Message Format Response message or status message also takes three parts separated by a space. ● HTTP protocol version ● status code ● textual status code HTTP/1.1 200 OK
  8. 8. Status Code status code is a 3 digit number, the first digit indicate the category of the code 1xx - indicates information message 2xx- indicates success 3xx- redirect client to another URL 4xx- error on the client side 5xx- error on the server side
  9. 9. HTTP Methods/Functions ● A HTTP method name is always uppercase. ● The most common HTTP methods are: GET, HEAD, POST and PUT.
  10. 10. GET METHOD This method GETS the web page or generally, the requested resource. GET /path/to/file/index.html HTTP/1.1
  11. 11. HEAD Method The same as the GET method, but it asks the server to return the response header not the resource data. There is no message body, just status line and the headers. It is useful if you want to know information about the file, or the the resource without downloading it. HEAD /hello.htm HTTP/1.0
  12. 12. POST Method This method sends/submits data to the server in some way to update it. What is the difference between a GET and a POST? ● The data in a post is sent with the request, in the message body such as the content type or content length. ● The resource URI is not something you download, it is a program to handle the data you’re sending. ● The response is a program output, not a static file.
  13. 13. POST Method example: POST /path/file.asp HTTP/1.1 name1=value1&name2=value2
  14. 14. PUT Method PUT requests the server to put/store the included message body in the given URL. PUT /hello.htm HTTP/1.0 headrName:.. .. <html> <body> <h1> Hello World! </h1></body></html>
  15. 15. DELETE Method Delete asks the server to delete the file at the given URL. DELETE /bye.htm HTTP/1.0
  16. 16. CONNECT Method The client uses this method to establish a network connection to a web server over HTTP. CONNECT HTTP/1.0
  17. 17. OPTIONS Method it is used by the client to investigate the methods and the options that are run by the server. The client can either use a URL or * in the request method. OPTIONS /someURL HTTP/1.0 OPTIONS * HTTP/1.0
  18. 18. TRACE Method Used to trace the contents of HTTP request. Used for debugging. TRACE HTTP/1.0
  19. 19. Other Methods ● LINK,UNLINK
  20. 20. References ● http://www.tutorialspoint. com/http/http_header_fields.htm ● ● http://www.w3. org/Protocols/rfc2616/rfc2616-sec9.html