HTTP

 HTTP


● Hypertext Transfer Protocol 

● An application protocol to transfer hypertext. 

● A client sends a request to the server and server replies with a response. Often, the client is a browser. 

● Default port: 80


HTTPS


Hypertext Transfer Protocol Secure. 

● Is an extension of HTTP. 

● Used for secure communication. 

● Default port: 443. 

● Encryption using SSL/TSL. 

        ○ SSL - Secure Sockets Layer. 

        ○ TSL - Transport Layer Security.


Hypertext/Hypermedia

● Hypertext is a node based text that contains hyperlinks. A hyperlink is a reference to data, that client can easily get (e.g. by clicking). 

● Hypermedia is super-set of Hypertext - it contains more features (like audio, video, graphics).


URL – Uniform Resource Locator


Identifies a resource by its location. 

● Protocol (http/https/ftp/file/etc.) 

● Domain name. 

● Optional port number (default port for http protocol is 80). 

● Path. 

● Optional query and or a fragment preceded by an hash - additional parameters can be passed.


URL Example



            subdomeniu                          path          querry
https://video.google.co.uk:80/videoplay?docid=-4283476529421&hl=n#00h02m30s

protocol              domeniu            port                       parametri                                             fragment


HTTP Request


HTTP request is a set of data that client sends to server. Contains the following: 
● URL 
● HTTP method 
● Headers 
● Body 


HTTP methods


Request methods

HTTP method Request has body Response has body
GET NO YES
POST YES YES
PUT YES YES
DELETE NO YES


HTTP Response


A HTTP server responses to a request with a response. HTTP response contains the following: 
● Status line (includes status code) 
● Headers 
● Body 

HTTP Status codes


1xx - Informational 

2xx - Success 
    ● 200 - OK 
    ● 201 - Created 
    ● 204 - No Content 

3xx - Redirection 
    ● 301 - Moved permanently

4xx - Client error 
    ● 400 - Bad request 
    ● 401 - Unauthorized 
    ● 403 - Forbidden 
    ● 404 - Not Found 
    ● 405 - Method not allowed 

5xx - Server error 
    ● 500 - Internal server error

HTTP Tools


Postman


● Postman is a collaboration platform for API development. 
● Quickly and easily send REST requests directly within Postman. 
● Developers use this tool to easily send HTTP requests in order to test the APIs they developed. 
● Download from https://www.postman.com/


Sending a POST REQUEST to a APACHE server who is listening at PORT 80. 
Parameter key = "file"
Value of parameter is "index.php".

This file "index.php" is located in the boot directory of the Apache server, witch is XAMPP/htdocs.



Niciun comentariu:

Trimiteți un comentariu