Understanding HTTP
What is HTTP and how does it work?
This is a very basic question that every web programmer should be able to understand and explain.
HTTP short for Hyper Text Transfer Protocol is the standard way for browsers and server to communicate.
Web browsers sends a request while web servers return a response.
Commonly used HTTP request:
- GET - request data from a specified resource or url.
- POST - submit data from specified resource or url.
GET vs Post
|
|
GET
|
POST
|
|
History
|
Parameters remain in the Browser
|
Parameters not shown in the browser
|
|
Bookmark
|
Can Be Bookmarked
|
Cannot be bookmarked.
|
|
Cached
|
Can be Cached
|
Can’t Be Cached
|
|
Back/Reload Browser Button
|
Clicking the Back button has no effect.
|
Clicking the back button causes re-submitting the form.
|
|
Encoding Type
|
application/x-www-form-urlencoded
|
multipart/form-data or application/x-www-form-urlencoded Use
multipart encoding for binary data.
|
|
Visibility
|
Query strings are visible in the url.
|
Its hidden.
|
|
Security
|
Less secure since query strings are send in plain text in the url and
is saved in the browser history.
|
Variables are not displayed in the url.
|
Other HTTP Methods
Comments