Home1xx HTTP Status CodesUncategorized1xx HTTP Status Codes

1xx HTTP Status Codes

1xx – Informational

This HTTP status code category provides a provisional response , which are distinguished by a simply Status Line and, potentially, some headers, followed by a blank line. These types of answers do not require any headers. Importantly, because HTTP/1.0 does not recognise any 1xx status codes, servers are not permitted to deliver a 1xx status code to an HTTP/1.0 client unless under experimental conditions. These codes are used to convey intermediate information while the server processes the request, and they are most useful in the context of HTTP/1.1 or newer protocols that define and use such answers.

100: Continue- Continue

This status code informs the client that the server has received the first part of the request and has not refused it. As a result, the client should proceed by sending the remainder of the request. This interim response is very helpful in optimising network consumption because it allows the client to wait for this acknowledgement before sending the bulk of the request.

Example of a 100: Continue

A huge file is being uploaded to a server by a client. It sends only the headers with a ‘Expect: 100-continue’ header before sending the complete file. If everything is well, the server responds with ‘100 Continue,’ instructing the client to transfer the entire file. This method reduces the amount of bandwidth wasted if the server rejects the entire request due to header errors.

101 – Switching Protocols

This code is sent in response to a client’s request (as part of the request headers) to the server to change protocols. This status number indicates that the server agrees to switch protocols as requested by the client. This could happen, for example, if you upgrade an HTTP 1.1 connection to a WebSocket, which allows for more interactive communication channels.

Example of a 101: Switching Protocols

Suppose a client wishes to establish a WebSocket connection with a website in order to exchange real-time data. It sends a request to the server with headers stating that it wants to switch from HTTP to WebSocket. If the server accepts the request and supports WebSockets, it responds with a ‘101 Switching Protocols’ response code, and the connection is upgraded to a WebSocket, allowing for two-way interactive communication.

Leave a Reply

Your email address will not be published. Required fields are marked *