官术网_书友最值得收藏!

The response header

Upon receiving a request and processing its contents, the server may respond with a message such as the one shown here:

The first line of the response header contains the status code (200), which is a three-digit code. This helps the browser understand the status of operation. The following are the details of a few important fields:

  • Status code: There is no field named status code, but the value is passed in the header. The 2xx series of status codes are used to communicate a successful operation back to the web browser. The 3xx series is used to indicate redirection when a server wants the client to connect to another URL when a web page is moved. The 4xx series is used to indicate an error in the client request and that the user will have to modify the request before resending. The 5xx series indicates an error on the server side, as the server was unable to complete the operation. In the preceding header, the status code is 200, which means that the operation was successful. A full list of HTTP status codes can be found at https://developer.mozilla.org/en-US/docs/Web/HTTP/Status.

  • Set-Cookie: This field, if defined, will establish a cookie value in the client that can be used by the server to identify the client and store temporary data.

  • Cache-Control: This indicates whether or not the contents of the response (images, script code, or HTML) should be stored in the browser's cache to reduce page loading times and how this should be done.

  • Server: This field indicates the server type and version. As this information may be of interest for potential attackers, it is good practice to configure servers to omit its responses, as is the case in the header shown in the preceding screenshot.

  • Content-Length: This field will contain a value indicating the number of bytes in the body of the response. It is used so that the other party can know when the current request/response has finished.

The exhaustive list of all of the header fields and their usage can be found at the following URL: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html.

主站蜘蛛池模板: 阳城县| 霍林郭勒市| 加查县| 呈贡县| 武强县| 龙海市| 营山县| 乃东县| 刚察县| 盖州市| 龙江县| 调兵山市| 金华市| 通化市| 六枝特区| 元谋县| 新宁县| 绍兴市| 碌曲县| 柳州市| 邹城市| 郧西县| 滁州市| 滦南县| 德阳市| 邵东县| 辉县市| 繁峙县| 大洼县| 阳春市| 芮城县| 汕头市| 黔西| 泰顺县| 永顺县| 大理市| 广河县| 磴口县| 汝阳县| 成武县| 富宁县|