curl使用方法


title: curl使用方法
date: 2019-06-06 17:35:27
tags:

【CDN排障工具CURL的使用方法】

# curl的常用参数:

-I Show document info only 只展示headers,发起HEAD请求
-o Write output to file instead of stdout 保存到本地
-x 用这个option可以指定http访问所使用的proxy服务器及其端口

-v Make the operation more talkative 可以显示一次http通信的整个过程,包括端口连接和http
-H Custom header to pass to server 添加header
-A/–user-agent [string] 指定UA访问
-e, –referer URL 指定referer
–resolve HOST:PORT:ADDRESS –resolve HOST:PORT:ADDRESS Force resolve of HOST:PORT to ADDRESS

# 测试:
域名为www.banyuh.com,边缘oc ip为182.254.52.213
只展示返回头:curl -I ‘http://www.banyuh.com’ -x 182.254.52.213:80

查看详细请求,文件不保存:curl -vo /dev/null ‘http://www.banyuh.com’

指定节点访问:
1.http:curl -vo /dev/null ‘http://www.banyuh.com’ -x 182.254.52.213:80
2.https:curl -vo /dev/null ‘https://www.banyuh.com’ –resolve www.banyuh.com:443:182.254.52.213

带Gzip测试:curl -vo /dev/null -H “Accept-Encoding: gzip,deflate” ‘http://www.banyuh.com’

使用refere: curl -e ‘http://www.banyuh.com’ ‘http://www.banyuh.com/2019/05/23/test/#more’ -vo /dev/null

带上指定 host请求: curl -H “Host:www.banyuh.com” ‘http://182.254.52.213/2019/05/23/test/#more’ -vo /dev/null

带分片range测试: curl -vo /dev/null ‘http://www.banyuh.com’ -H ‘Range:bytes=0-0’


已发布

分类

来自

标签:

评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注