HTTP Requests are messages which are sent by the client or user to initiate an action on the server.
The first line of the message includes the request message from the client to the server, the method which is applied to the resource, identifier of the resource, and the protocol version.
The Request-Line starts with a method token, which is followed by the Request-URI, the protocol version, and ending with CRLF. Using the SP characters, the elements are separated.
The method token is used to indicate the method which was performed on the resource identified by the Request-URI. The method is case sensitive.
A resource is allowed a list of methods and that methods can be specified in an Allow header field. The response's return code always notifies the client whether a method is currently allowed on a resource. Since the set of allowed methods can be changed dynamically.
Method and Description:
This method retrieves information from the given server using a given URI. GET request can retrieve the data. It cannot apply other effects on the data.
The HEAD method is the same as the GET method. It is used to transfer the status line and header section only.
The POST request sends the data to the server. For example, file upload, customer information, etc. using the HTML forms.
The PUT method is used to replace all the current representations of the target resource with the uploaded content.
The DELETE method is used to remove all the current representations of the target resource, which is given by URI.
The CONNECT method is used to establish a tunnel to the server, which is identified by a given URI.
The Request-URI is a Uniform Resource Identifier. It is used to identify the resource upon which to apply the request.
On the nature of the request, these four options for Request-URI depend.
a) The asterisk "*" is used to show that the request does not apply to a particular resource, but it will apply to the server itself. It is allowed only when the method used does not necessarily apply to a resource.
OPTIONS * HTTP/1.1
b) The absoluteURI form is used only when the request is being made to a proxy. The requested proxy is used to forward the request and return the response.
GET http://www.javatpoint.com/WWW/TheProject.html HTTP/1.1
c) The absolute path can't be empty. If in the original URI, none is present, it must be given as "/".
d) The authority form is only used by the CONNECT method.
The Resource Identified by a Request
Using the examination of Request-URI and the Host header field, we can determine the exact resource identified by the Internet request.
An origin server must use the following rules for determining the requested resource on an HTTP/1.1 request if the origin server does differentiate based on the host requested.
Request Header Fields
The request-header fields are used to allow the client to pass additional information to the server like the request and the client itself. The request header fields act as request modifiers, with semantics equivalent to the parameters on a programming language method invocation.
The name of the request-header field can be extended reliably only in combination with a change in the version of the protocol.