Overview :
- HTTP stands for HyperText Transport Protocol, and is the network protocol used over the web. It runs over TCP/IP.
- HTTP uses a request/response model. Client sends an HTTP request, then the server gives back the HTTP response that the browser will display (depending on the content type of the answer) If the response is an HTML file, then the HTML file is added to the HTTP response body
- An HTTP response includes : status code, the content-type (MIME type), and actuel content of the response
- A MIME type tells the browser what kind of data the response is holding URL stands for Uniform Resource Locator: starts with a protocol, then a server name, optionnaly followed by a port number, then the path to the resource followed by the resource name. Parameters may appear at the end, separated from the rest by a ?
HTTP methods
_________________________________________________________________________________
GET Gets the data identified by an URI
POST Same, the request’s body is passed to the resource specified by the URI
HEAD Sends back only the header of the response that would be sent by a GET
PUT Sends to the server data to store at specified URI. Server does not process the
data ; it only stores them
DELETE Delete specified resource
TRACE When it receives this request, the server sends it back to the client
OPTIONS Ask server informations about a resource or about its own capabilities
CONNECT Ask for a connction (tunnelling)
_________________________________________________________________________________
Differences between GET and POST
POST has a body.
GET parameters are passed on the URL line, after a ?. The URL size is limited.
The parameters appear in the browser URL field, hence showing any password to the world...
GET is supposed to be used to GET things (only retrieval, no modification on the server).
GET processing must be idempotent.
A click on a hyperlink always sends a GET request.
GET is the default method used by HTML forms. Use the method=”POST” to change it.
In POST requests, the parameters are passed in the body of the request, after the header. There is no
size-limit. Parameters are not visible from the user.
POST is supposed to be used to send data to be processed.
POST may not be idempotent and is the only one.
IDEMPOTENT : Can do the same thing over and over again, with no negative side effect.
No comments:
Post a Comment