卷曲:没有在日志中显示我的标题

时间:2018-04-09 19:20:39

标签: curl

我正在尝试使用curl在命令行中调试传出的GET HTTP请求。

curl --header "Authorization: Basic AAABBBCCCCDDDEEFFF=" https://myserver:8443/user?id=9829878 -vvv

输出日志未显示我之前设置的“授权”标题:

*   Trying 10.30.215.211...
* TCP_NODELAY set
* Connected to (nil) (10.30.215.211) port 3128 (#0)
* Establish HTTP proxy tunnel to myserver:8443
> CONNECT myserver:8443 HTTP/1.1
> Host: myserver:8443
> User-Agent: curl/7.52.1
> Proxy-Connection: Keep-Alive
>
< HTTP/1.0 403 Forbidden
< Server: squid/3.1.23
< Mime-Version: 1.0
< Date: Mon, 09 Apr 2018 19:16:00 GMT
< Content-Type: text/html
< Content-Length: 3207
< X-Squid-Error: ERR_ACCESS_DENIED 0
< Vary: Accept-Language
< Content-Language: en
< Connection: keep-alive
<
* Received HTTP code 403 from proxy after CONNECT
* Curl_http_done: called premature == 0
* Closing connection 0
curl: (56) Received HTTP code 403 from proxy after CONNECT

我的curl请求中是否有任何错误设置我的标题内容?

1 个答案:

答案 0 :(得分:0)

首先尝试建立与代理的连接,但是失败了,因此永远不会发送--proxy-header标头。如果要将标头发送到代理而不是目标,请使用--header而不是--proxy-header。如果您要将标头发送给两者,请同时使用-header和{{1}}。