1 HTTP protocol related
① Force the request to http1.0
7.29 version 'default' is http1.1
② Check whether the current curl version supports http2
Method '2': curl --version to see 'Features'
Supplement: '7.33.0' version has only 'introduced' http2, and can use 'curl' to issue http2.0 version 'requests'
③ Forced to send http3
Instructions: Just 'Understand'
2. HTTP Header related
① -i, -I response header
+ + + + + + + + + + + + + + + "Analysis of the Two" + + + + + + + + + + + + + + + + 1. The -i 'lowercase' parameter can display the header information of the http response, together with the 'web page source code' 2. The -I 'uppercase' parameter will 'only display' the header information of the http response. Key point: curl '-I' initiates a 'HEAD' request
3. Demo 'case' explanation
② -D saves the response header to the specified file
③ -H Custom request header
1. curl 'certain' option parameters are equivalent to 'custom' corresponding request headers Detail 1: If the key of the request header is defined in a request header but the value is not defined, you need to put a 'semicolon;' after the key. semicolon --> 'semicolon' Detail 2: Use an external request header without any value on the right side of "colon:" to "overwrite the internal request header" to "remove" the internal request header. For example: -H "Host:", empty host header --> 'Customize Host header to match nginx's server_name' Detail 3: Multiple 'request headers' require specifying multiple '-H' parameters
④ -b Send Cookie request header
Understanding: The 'request header' of the curl built-in option and the 'equivalent' form of '-H' ? 1. '-b' | '--cookie' sends 'Cookie request header' Note: This method is to directly 'write the Cookie string' or 'Cookie file' in the 'Command' Equivalent: You can also use -H 'Cookie:' to send
Note: 1. Cookie multiple 'key-value' are separated by 'semicolon;' 2. Read the 'key-value' passed as the 'file' in the Cookie request header
Cookie principle, Set-Cookie common fields, applications
⑤ -A request client
'-A' | '--user-agent' --> Generally use 'abbreviation'
⑥ -e, –referer
Note: The 'Referer' request header contains the address of the 'source page' requesting the 'current requested page' --> Jumped from 'where'
⑦ -c Get the response header Set-Cookie
1. '-c' | '--cookie-jar' Get the 'response header' Set-Cookie --> "Just understand"
⑧ -X request method Key points
1. -X | '--request' Note: curl -I 'defaults' to issue a 'HEAD' request, and 'only' obtains the 'response header', that is, the 'metadata' information. Details: Generally, it is a 'GET' request, and the '-d' parameter will make a 'POST' request. Emphasis: Can 'support' various 'semantics' of Restful API
2. The 'semantics' of various 'request methods' Note: CDN has strict support for various 'request methods'
⑨ Case of request method
1. '-G' | --get 'Force' to send a 'GET' request, rather than according to curl's 'context' --> For example '-d' Details: Change the request method of '-d (default is POST)' by 'appending -G', that is, the 'GET request' carries 'body'
curl -G -d enables GET requests to also carry the request body. The difference between GET and HEAD requests
Supplement: -IG sends 'HEAD' request --> '-I' has a higher priority
Legacy: You must use 'curl''s 'scenario' and curl's 'vulnerability' For example: The lower version of 'k8s' cannot be selected on the 'UI' page, but the 'API' interface is still there. You can use curl to create a 'lower version' cluster