HTTP only if certain constraints in header

HTTP Methods:   There
are 9 main methods in HTTP. These methods indicate what action has to be taken
on the resource. These methods make sure that the client gets the expected
result i.e. the resource he/she desires. Generally resources are the server’s
files or any executable running on the server.

 

According to HTTP/1.0 specs three main methods were
specified:

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

1) GET

2) HEAD

3) POST

Later in HTTP/1.1 specs 5 more methods were defined:

4) OPTIONS

5) PUT

6) DELETE

7) TRACE

8) CONNECT

RFC 5789 added the PATCH method

9) PATCH

  

1)     
GET: This method is used to retrieve the
aforementioned resource. It is the most popularly used method to retrieve
information. Response of a GET request can be cached.

 

A conditional GET can also be used by adding certain constraints like If-Match, If-None-Match, or If-Range header field, If-Modified-Since, If-Unmodified-Since. A conditional GET works only if certain constraints in header field are fulfilled. Over network usage can be avoided by using partial GET, which specifies Range header field in the request itself.

 

2)     
HEAD: This method is quite synonymous to GET
method but the only striking difference between the two is that the HEAD method
returns an empty Message Body in response.

Response to HEAD may be cached if it varies
from previous cached versions.

This method is popularly used to fetch
meta-information from headers.

 

3)     
POST: This method is used to send some data to
server this data is encapsulated in request body, generally to store it. For e.g.:
web forms. POST method has no restrictions to amount of data that can be sent
as a part of query as it encapsulates this data into request message body. Whereas
in GET method there’s restriction over amount of data in query string.

Also this method is preferable while
transferring confidential information like passwords as URL encoded query won’t
appear in browser’s address box.

It is an idempotent method.

 

4)     
OPTIONS:  This method is used to retrieve information
about the HTTP service options for target resource available at the sever end
or intervening intermediary’s end. We can also determine the server’s capabilities
using this method with ‘*’.

Responses to this method are not cacheable.

 

5)     
PUT: This method updates representation of
aforementioned URI. If aforementioned URI already exists then this must be
considered as the updated version of the URI at origin server. If no such
resource is pre-existing then resource with specified URI is created and 201-created
response is replied to user agent else 200 or 204 is sent to UA.

Responses to this method are not cacheable.

 

6)     
DELETE: This method is used to delete the
aforementioned resource in the URL. This method can be overridden by server
intervention and there is no assurance that user’s requested file will be
deleted in spite of receiving positive response from server.

Responses to this method are not cacheable.

 

7)     
TRACE: