HTTP header Servlet defaults to text/plain, but it usually needs to be explicitly specified as text/html. Because Content-Type is often set, HttpServletResponse provides a special method, setContentType.
Some types of HTTP request headers:
1, Accept: MIME types acceptable to browsers.
2.Accept-Charset: the character set acceptable to the browser.
3.Accept-Encoding: a data encoding method that the browser can decode, such as gzip. Servlet can return gzip-encoded HTML pages to browsers that support gzip. In many cases, this can reduce the download time by 5 to 10 times.
4.Connection: indicates whether a persistent connection is required. If the Servlet sees that the value here is "Keep-Alive", or requests to use http1.1(http1.1makes persistent connection by default), it can take advantage of persistent connection, and when the page contains multiple elements (such as applets and pictures), it can significantly reduce the download requirements.
5.Content-Length: indicates the length of the request message body.
6.Cookie: This is one of the most important request header information.
Extended data:
CURL library in PHP (part);
1, cURL _ Set opt _ array— Set options for cURL bulk transfer sessions.
2.cURL _ setopt sets cURL transmission options.
3.cURL _ close closes the cURL session.
4.cURL _ copy _ handle copies a cURL handle and all its options.
5.curl _ errno— Returns the last error number.
6.curl _ error returns a string that protects the latest error of the current session.
7.curl _ escape— Use url to encode the given string.
In practice, the most commonly used function is cURL _ setopt—-setting a description of cURL transmission option: bool URL _ setopt(resource $ ch, int $ option, mixed $ value), where ch is the cURL handle returned by curl_init (). Option indicates the CURLOPT_XXX option that needs to be set.
Optional parameters of the option:
1 and CURLOPT_BUFFERSIZE will read the size of the cache every time they get data, but there is no guarantee that they will fill this value every time. Add in cURL 7. 10.
2.CURLOPT_CLOSEPOLICY is CURLCLOSEPOLICY_ Last _ Used or CURLCLOSEPOLICY_OLDEST. There are three other Curl loss policies _, but curl doesn't support them yet.
3.CURLOPT_CONNECTTIMEOUT Time to wait before starting the connection. If set to 0, it will wait indefinitely.
Baidu encyclopedia -http request header
Baidu encyclopedia-curly