Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
June 23, 2021 10:03 pm GMT

HTTP headers HTTP Request and Response

HTTP PROTOCOL

HTTP stands for Hyper text transfer protocol.The Hypertext Transfer Protocol is an application protocol for distributed, collaborative, hypermedia information systems that allows users to communicate data on the World Wide Web.

HTTP HEADERS
The HTTP headers are used to pass additional information between the clients and the server through the request and response header. All the headers are case-insensitive, headers fields are separated by colon, key-value pairs in clear-text string format. The end of the header section denoted by an empty field header. There are a few header fields that can contain the comments. And a few headers can contain quality(q) key-value pairs that separated by an equal sign. There are four kinds of headers context-wise:
General Header:
This type of headers applied on Request and Response headers both but with out affecting the database body.
Request Header:
This type of headers contains information about the fetched request by the client.
Response Header:
This type of headers contains the location of the source that has been requested by the client.
Entity Header:

This type of headers contains the information about the body of the resources like MIME type, Content-length.

REQUEST HEADERS

Some common HTTP Request headers are discuss;
Host Header:
The host header specifies which website or web application should process an incoming HTTP request. The web server uses the value of this header to dispatch the request to the specified website or web application. Each web application hosted on the same IP address is commonly referred to as a virtual host.
User Agent:
The User Agent string contains information about your web browser name, operating system, device type and lots of other useful bits of information.
Alt Text
Authentication Headers:
HTTP authentication is a simple challenge and response mechanism with which a server can request authentication information (a user ID and password) from a client. The client passes the authentication information to the server in an Authorization header.

Cookie:
It is a request type header. A cookie used in the requests sent by the user to the server.
Alt Text

RESPONSE HEADERS

Status code
This is a list of Hypertext Transfer Protocol (HTTP) response status codes. Status codes are issued by a server in response to a client's request made to the server.

All HTTP response status codes are separated into five classes or categories. The first digit of the status code defines the class of response, while the last two digits do not have any classifying or categorization role. There are five classes defined by the standard:

  • 1xx informational response the request was received, continuing process
  • 2xx successful the request was successfully received, understood, and accepted
  • 3xx redirection further action needs to be taken in order to complete the request
  • 4xx client error the request contains bad syntax or cannot be fulfilled
  • 5xx server error the server failed to fulfil an apparently valid request,

Alt Text

1.Content-Type:
In responses, a Content-Type header tells the client what the content type of the returned content actually is form.
2.Set-cookies:
The HTTP header Set-Cookie is a response header and used to send cookies from the server to the user agent. So the user agent can send them back to the server later so the server can detect the user.
3. Content-Length:
HTTP Content-Length entity-header is used to indicate the size of entity-body in decimal no of octets i.e. bytes and sent it to the recipient. It is a forbidden header name. Basically it is the number of bytes of data in the body of the request or response.
Alt Text

Alt Text


Original Link: https://dev.to/sanawar78/http-headers-http-request-and-response-3cf8

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To