0、curl 显示连接的常用方法

curl -d "hello=world" https://const.net.cn/test/ --verbose

输出结果:
...

  • Server certificate:
  • subject: CN=const.net.cn
  • start date: May 19 00:00:00 2021 GMT
  • expire date: May 18 23:59:59 2022 GMT
  • subjectAltName: host "const.net.cn" matched cert's "const.net.cn"
  • issuer: C=CN; O=TrustAsia Technologies, Inc.; OU=Domain Validated SSL; CN=TrustAsia TLS RSA CA
  • SSL certificate verify ok.

POST /test/ HTTP/1.1
Host: const.net.cn
User-Agent: curl/7.68.0
Accept: /
Content-Length: 11
Content-Type: application/x-www-form-urlencoded

  • upload completely sent off: 11 out of 11 bytes
    ...

1、curl 显示 form 数据

curl -d "hello=world" https://const.net.cn/test/ --trace-ascii /dev/stdout

输出结果:
0000: POST /test/ HTTP/1.1
0016: Host: const.net.cn
002a: User-Agent: curl/7.68.0
0043: Accept: /
0050: Content-Length: 11
0064: Content-Type: application/x-www-form-urlencoded
0095:
=> Send data, 11 bytes (0xb)
0000: hello=world
== Info: upload completely sent off: 11 out of 11 bytes

2、curl 显示 boundary 数据

curl -F "hello=world" -F file=@/etc/timezone https://const.net.cn/test/ --trace-ascii /dev/stdout

输出结果:

0000: POST /test/ HTTP/1.1 0016: Host: const.net.cn 002a: User-Agent:
curl/7.68.0 0043: Accept: / 0050: Content-Length: 313 0065:
Content-Type: multipart/form-data; boundary=-------------------- 00a5:
----584e7b2299bf345b 00bb:
=> Send SSL data, 5 bytes (0x5) 0000: ....J
=> Send SSL data, 1 bytes (0x1) 0000: .
=> Send data, 313 bytes (0x139) 0000: --------------------------584e7b2299bf345b 002c: Content-Disposition: form-data; name="hello" 005a: 005c: world 0063:
--------------------------584e7b2299bf345b 008f: Content-Disposition: form-data; name="file"; filename="timezone" 00d1: Content-Type:
application/octet-stream 00f9: 00fb: Asia/Shanghai. 010b:
--------------------------584e7b2299bf345b--
== Info: We are completely uploaded and fine

本文链接地址:https://const.net.cn/19.html

标签: shell

添加新评论