HTTP Interview Question
HTTP Interview Questions
HTTP Interview Question for Freshers
What is HTTP ?
HTTP stands for Hypertext Transfer Protocol. It is a set of rule which is used for transferring the files like, audio, video, graphic image, text and other multimedia files on the WWW (World Wide Web). HTTP is a protocol that is used to transfer the hypertext from the client end to the server end, but HTTP does not have any security. Whenever a user opens their Web Browser, that means the user indirectly uses HTTP.
Describe the key advantages of HTTP/2 as compared with HTTP 1.1.
HTTP/2 provides decreased latency to improve page load speed by supporting; Data compression of HTTP headers. Server push technologies. Loading of page elements in parallel over a single TCP connection. Prioritization of requests. An important operational benefit of HTTP/2 is that it avoids the head-of-line blocking problem in HTTP 1.
What's the difference between GET and POST?
GET: If we are sending parameters in a GET request to the server, then those parameters will be visible in the URL, because in GET, parameters are append to the URL. So there's a lack of security while uploading to the server. We can only send a limited amount of data in a GET request, because the URL has its max limit and we can not append a long data string to the URL.
POST: If we are using POST then we are sending parameters in the body section of a request. If we send data after using encryption in the body of an http request, it's quite a bit more secure. We can send a lot more data using POST.
Explain different types of HTTP request methods?
- GET
- POST
- PUT
- HEAD
- DELETE
- OPTION
We are going to discuss the above methods one by one in complete tutorial of http, http tutorial
What is the status code?
The status code is a 3-digit integer where the first digit defines the class of response and the last 2-digits do not have a specific categorization roles. Status codes are issued by a server in response to a client's request to the server. For the first digit, five classes are defined.
- 1xx informational response: The request was received and continue the 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 fulfill an apparently valid request.
What is an HTTP session state ?
HTTP is a stateless protocol. A stateless protocol does not require the server to maintain the information or status about each user during the transaction of multiple requests.
What is a secure HTTP connection ?
To establish a secure HTTP connection, currently, there are two methods. The HTTPs url scheme and HTTP 1.1 upgrade header.
What is cURL in HTTP ?
cURL is a command line tool that is available on all major operating systems.
What are the safe and unsafe methods of HTTP ?
safe methods are those that never modify resources. The only safe methods, from the four listed above, is GET. The others are unsafe, because they may result in a modification of the resources.
What is the mean of 201 Created HTTP response codes ?
This indicates the request was successful and a resource was created. It is used to confirm success of a PUT or POST request.
What is the mean of 400 Bad Request HTTP response codes ?
The request was malformed. This happens especially with POST and PUT requests, when the data does not pass validation, or is in the wrong format.
What is the mean of 404 Not Found HTTP response codes ?
This response indicates that the required resource could not be found. This is generally returned to all requests which point to a URL with no corresponding resource.
What is the mean of 401 Unauthorized HTTP response codes ?
This error indicates that you need to perform authentication before accessing the resource.
What is the mean of 405 Method Not Allowed HTTP response codes ?
The HTTP method used is not supported for this resource.
What is the mean of 409 Conflict HTTP response codes ?
This indicates a conflict. For instance, you are using a PUT request to create the same resource twice.
Explain secure HTTP ?
There are currently two methods of establishing a secure HTTP connection: the https URI scheme and the HTTP 1.1 Upgrade header, introduced by RFC 2817. Browser support for the Upgrade header is, however, nearly non-existent, so HTTPS is still the dominant method of establishing a secure HTTP connection. Secure HTTP is notated by the prefix https:// instead of http:// on web URIs.
What are status codes in HTTP ?
In HTTP/1.0 and since, the first line of the HTTP response is called the status line and includes a numeric status code (such as "404") and a textual reason phrase (such as "Not Found"). The way the user agent handles the response primarily depends on the code and secondarily on the response headers. Custom status codes can be used since, if the user agent encounters a code it does not recognize, it can use the first digit of the code to determine the general class of the response.
What are HTTP verbs?
HTTP verbs tell the server what to do with the data that is identified by the URL. The data can contain additional information about the operation that needs to be performed.
Describe different roles of HTTP ?
In HTTP, there are two roles- client and server. The client always sends the message to the server, server reply to the conversation.
Explain Idempotent Methods?
An idempotent method is one of the HTTP methods that can be called many times with different outcomes or values. If the idempotent method is called once or multiple times, it gives the same result.
What is an HTTP session state ?
HTTP is a stateless protocol. A stateless protocol does not require the server to maintain the information or status about each user during the transaction of multiple requests.
What is Caching ?
Caching is the process in which server response is stored so that a cached copy can be used when required and there is no need for generating the same response again. This process not only reduces the server load but in turn increase the scalability and performance of the server. Only the client is able to cache the response and that too for a limited period of time.
What is the mean of 100 Continue response code in HTTP ?
This code is used to show that the client should continue with its request. The interim response informs the client that the request's initial part has been received.
Tell me to which OSI Layer does IP belong ?
In the OSI layer, IP belongs to the Network layer, which is the third layer in the OSI layer.
What are 500 Internal Server Error response codes in HTTP ?
This code is used to show that the server has encountered a situation, and it does not know how to handle it.
What are HTTP Request Messages ?
HTTP Requests are messages which are sent by the client or user to initiate an action on the server. It consists of various things; Request Line, The Resource Identified by a Request and Request Header Fields.