What are different Parts of an HTTP request?

Asked By 30 points N/A Posted on -
qa-featured

What are different Parts of an HTTP request? Explain each part.

SHARE
Best Answer by keeshanne
Answered By 0 points N/A #96103

What are different Parts of an HTTP request?

qa-featured

Answer:-

Request Method: It tells the server the type of action that a client wants to perform.

URI: Uniform Resource Indicator specifies the address of required document or resource

Header Fields: Optional headers can be used by the client to tell server extra information about request e.g. Client software and content type that it understands.

Body: Contains data sent by the client to the server

Other request headers like FROM (email of the person responsible for request)

And VIA (used by gateways and proxies to show intermediate sites the request

Passes) can also be used.

Answered By 0 points N/A #96104

What are different Parts of an HTTP request?

qa-featured

Parts of HTTP request:

  • An HTTP request is used to return a document or file requested by the client.
  • The URI uniform resource identifier is used to identify files or resource on the web server.
  • HTTP request contains the following methods Head GET and POST methods:
  • HEAD method is similar to GET method but the only difference is that it will ask the web server to return the response headers only but not the resource.
  • GET method is used to get the requested data or information, but the problem with the GET method is it allows a limited amount of data should be sent by the client while requesting for a resource.
  • The POST method is used to send data to server for requesting resource, In this method you can send an unlimited amount of data to the webserver.
  • Header Fields provide information regarding the request sent by the client and the response sent by the webserver .
  • Body provides information sent by the client to the webserver. 
Best Answer
Best Answer
Answered By 0 points N/A #96105

What are different Parts of an HTTP request?

qa-featured

Underlying the user interface represented by browsers, is the network and the protocols that travel the wires to the servers or "engines" that process requests, and return the various media. The protocol of the web is known as HTTP. HTTP is the underlying mechanism on which CGI operates, and it directly determines what you can and cannot send or receive via CGI.

HTTP provides two primary methods to request documents: GET or POST.

The foundation of HTTP/0.9 (the first implementation of the HTTP protocol) was the definition of the GET method that was used by a web browser to request a specific document.

For example, the following HTTP request would return the document "index.html" that was located in the web server's root directory called "webdocs."

Notice that the GET request began with the GET keyword, included a document to retrieve, and ended with a carriage return and line feed combination.

If you would like, you can try making a GET request by connecting to your favorite web server and sending the GET request yourself (as if you were a web browser).

The beauty of web browsers of course, is that they take care of the HTTP protocol specifications so that the user only needs to enter the URL of the page they want to see. The web browser formulates the actual GET request, sends it to the web server, receives the HTML document back, and then displays the HTML document according to the HTML instructions.

Besides allowing web browsers (or you pretending to be one) to get documents from a web server, the GET method also implements a method for a web browser to send optional search parameters as well; (it was used with ISINDEX HTML files originally).

The search parameters were encoded in a special way that the web server can deal with.

Encoding works like this:

Since you may want to have multiple search parameters, the GET method specifies that parameters are differentiated by placing an ampersand sign (&) between them. Thus, the encoded URL above becomes something like the following:

http://www.domain.com/dir/file?search1&search2&search3

Next, search parameters themselves are specified as "name/value pairs" separated by an equal sign (=) such as in the following example that sets the variable "name" equal to "Sol" and the variable "fname" equal to "Selena":

http://www.domain.com/dir/file?lname=Sol&fname=Selena

Further, any spaces in the encoding string are replaced by plus signs (+) as in the following example:

http://www.domain.com/dir/file?name=Selena+Sol&age=28

Finally, any non-alphanumeric characters are replaced with their hexadecimal equivalents that are escaped with the percent sign (%). For example, a single quote character (') is encoded as %27 and a line break (which is a carriage return plus a line feed) is encoded as %0D%0A. Thus, we might see the following example that specifies that the variable pageName is equal to "Selena Sol's Page":

http://www.domain.com/dir/file?pageName=Selena+Sol%27s+Page

Though the GET method was very useful, a couple of serious problems remained.

First, the GET method only allowed a limited amount of data (1024 characters) to be sent as URL encoded data.

If there were too many name/value pairs, some of them would be clipped and data would get lost.

This all changed with the development of HTTP/1.0.

The HTTP/1.0 protocol was developed from 1992 to 1996 in order to satisfy the need to exchange more than simple text information.

The first major change from the HTTP/0.9 specification was the use of MIME-like headers in the request and response messages.

The next HTTP change was the definition of new request methods: HEAD and POST.

Let's look at both of these changes in greater depth. Under HTTP/1.0 an HTTP transaction consisted of a header followed by an empty line and then some extra data.

We have already talked about the header. The POST method of input was the other important change brought about by the introduction of HTTP/1.0.

The POST method allowed web browsers to send an unlimited amount of data to a web server by allowing them to tag it on to an HTTP request after the request headers as the message body.

Answered By 0 points N/A #96106

What are different Parts of an HTTP request?

qa-featured

HTTP is a request-response oriented protocol with no built in state management between successive requests hence being a stateless protocol

Parts of an HTTP request

1. Request method:Tells the server the type of action the clients want to be performed.

A full request message always begins with a Request-Line, which has the following format:

Request-Line=Method SP Request-URL HTTP Version CRLF

Methods in HTTP/1.1

a) OPTIONS: a request for information about the options available for the request/response chain identified by this URL

b) GET a request to retrieve the information identified in the URL and return it in an entity body. A GET is conditional if the If-Modified-Since header field is included and is partial if a Range header field is included

c) HEAD the request is identical to a GET, except that the server’s response must not include an entity body; all of the header fields in the response are the same as if the entity body were present. This enables a client to get information about a resource without transferring the entity body.

Other methods are:

POST, PUT, PATCH, COPY, MOVE, DELETE, LINK, UNLINK, TRACE, WRAPPED, EXTENSION

2. URI: Uniform Resource Indicator specifies the address of the required document.

3. Header fields: Option headers can be used by the client to tell server extra information about request e.g. Client software and content type that it understands.

Fields defined in HTTP/1.1:

Accept, Accept-Charset, Accept-Encoding, Accept-Language, Authorization, From, Host, If-Modified Since, Range, Referrer, Unless, User-Agent, Proxy-Authorization

4. Body: contains data sent by the client

Request headers

FROM:Email of the person responsible for the request

VIA: Used by gateways and proxies to show intermediate sites the request passes

GET / index.html HTTP/1.1

Request Line

Host: java.sun.com

User-Agent: Mozilla/4.0 [en]

Accept: file/doc, file/pdf, file/ppt, */*

Accept-Language: en

Accept-Charset: ISO-8859-1, *. utf-8

Request headers

Request parameters

Optional request body

Request parameters

1. In URL as query string e.g. https://www.facebook.com/?ref=home

2. As part of the request, i.e.

gateways and proxies to show intermediate sites the request passes

Login/Register to Answer

Related Questions