curl英文直译
阅读原文时间:2023年07月09日阅读:1

文档概述 比较表 curl手册页 常见问题 HTTP脚本编写 mk-ca-bundle 教程
curl / 文件 / 工具文档 /手册页
curl.1手册页
相关:
手动
常见问题解答
HTTP脚本

名称
curl-传送网址

概要
curl [选项/网址]

描述
curl是一种使用支持​​的协议(DICT,FILE,FTP,FTPS,GOPHER,HTTP,HTTPS,IMAP,IMAPS,LDAP,LDAPS,POP3,POP3S,RTMP,RTSP, SCP,SFTP,SMB,SMBS,SMTP,SMTPS,TELNET和TFTP)。该命令设计为无需用户干预即可工作。

curl提供了大量有用的技巧,例如代理支持,用户身份验证,FTP上传,HTTP帖子,SSL连接,cookie,文件传输简历​​,Metalink等。正如您将在下面看到的,许多功能将使您的头旋转!

libcurl为所有与传输相关的功能提供curl支持。有关详细信息,请参见libcurl(3)。

网址
URL语法与协议有关。您将在RFC 3986中找到详细说明。

您可以通过在括号内编写部分集来指定多个URL或URL的一部分,如下所示:

http://站点。{one,two,three} .com

或者,您也可以使用[]来获取字母数字系列的序列,如下所示:

ftp://ftp.example.com/file[1-100].txt

ftp://ftp.example.com/file [001-100] .txt (带前导零)

ftp://ftp.example.com/file[az].txt

不支持嵌套序列,但是可以将多个序列彼此相邻使用:

http://example.com/archive[1996-1999]/vol[1-4]/part {a,b,c} .html

您可以在命令行上指定任意数量的URL。它们将以指定顺序以顺序方式获取。您可以在命令行上以任意顺序指定命令行选项和URL。

您可以为范围指定一个步进计数器,以获取每个第N个数字或字母:

http://example.com/file[1-100:10].txt

http://example.com/file[az:2].txt

在命令行提示符下使用[]或{}序列时,可能必须将完整的URL放在双引号中,以避免shell干扰它。其他特殊字符也是如此,例如'&','?' 和“ *”。

在URL中为IPv6区域索引提供转义的百分号和接口名称。像

http:// [fe80 :: 3%25eth0] /

如果您指定不带protocol://前缀的URL,curl将尝试猜测您可能想要的协议。然后它将默认为HTTP,但会根据常用的主机名前缀尝试其他协议。例如,对于以“ ftp”开头的主机名。curl将假定您要讲FTP。

curl会尽力将您传递给它的内容用作URL。它没有尝试通过任何方式将其验证为语法正确的URL,而是对其接受的内容非常宽容。

curl将尝试重用连接以进行多个文件传输,以便从同一服务器获取许多文件不会进行多次连接/握手。这样可以提高速度。当然,这仅在单个命令行上指定的文件上完成,不能在单独的curl调用之间使用。

进度表
curl通常在操作过程中显示进度表,指示传输的数据量,传输速度和剩余的估计时间等。进度表显示字节数,速度以每秒字节数为单位。后缀(k,M,G,T,P)基于1024。例如1k是1024字节。1M是1048576字节。

curl默认情况下会将此数据显示给终端,因此,如果您调用curl进行操作并且将要向终端写入数据,它将禁用进度条,否则会混淆输出混合进度条和响应数据。

如果要使用HTTP POST或PUT请求的进度表,则需要使用shell重定向(>),- o,--output或类似方法将响应输出重定向到文件。

FTP上传的情况不同,因为该操作不会向终端吐出任何响应数据。

如果您更喜欢进度“栏”而不是常规的仪表-#,则--progress-bar是您的朋友。您也可以使用-s,-silent选项完全禁用进度表。

选件
选项以一或两个破折号开头。许多选项旁边都需要附加值。

选项的短“单破折号”形式(例如-d)可以在其与其值之间留有或不留空格,尽管建议使用空格。长的“双破折号”格式,例如-d,--data,需要在它和它的值之间留一个空格。

不需要任何附加值的简短版本选项可以立即彼此相邻使用,例如,您可以一次将所有选项-O,-L和-v指定为-OLv。

通常,所有布尔选项都使用- 选项启用,然后再次使用-no-选项禁用。也就是说,您使用完全相同的选项名称,但将其前缀为“ no-”。但是,在此列表中,我们主要仅列出并显示它们的--option版本。(在7.19.0中添加了--no选项的概念。以前,大多数选项是在重复使用同一命令行选项时打开/关闭的。)

--abstract-unix-socket <路径>

(HTTP)通过抽象的Unix域套接字连接,而不是使用网络。注意:netstat显示以“ @”为前缀的抽象套接字的路径,但是参数不应具有此前导字符。

在7.53.0中添加。

--alt-svc <文件名>

(HTTPS)警告:此选项是实验性的。请勿在生产中使用。

This option enables the alt-svc parser in curl. If the file name points to an existing alt-svc cache file, that will be used. After a completed transfer, the cache will be saved to the file name again if it has been modified.

Specify a "" file name (zero length) to avoid loading/saving and make curl just handle the cache in memory.

If this option is used several times, curl will load contents from all the files but the the last one will be used for saving.

Added in 7.64.1.

--anyauth

(HTTP) Tells curl to figure out authentication method by itself, and use the most secure one the remote site claims to support. This is done by first doing a request and checking the response-headers, thus possibly inducing an extra network round-trip. This is used instead of setting a specific authentication method, which you can do with --basic, --digest, --ntlm, and --negotiate.

Using --anyauth is not recommended if you do uploads from stdin, since it may require data to be sent twice and then the client must be able to rewind. If the need should arise when uploading from stdin, the upload operation will fail.

Used together with -u, --user.

See also --proxy-anyauth and --basic and --digest.

-a, --append

(FTP SFTP) When used in an upload, this makes curl append to the target file instead of overwriting it. If the remote file doesn't exist, it will be created. Note that this flag is ignored by some SFTP servers (including OpenSSH).

--basic

(HTTP) Tells curl to use HTTP Basic authentication with the remote host. This is the default and this option is usually pointless, unless you use it to override a previously set option that sets a different authentication method (such as --ntlm, --digest, or --negotiate).

Used together with -u, --user.

See also --proxy-basic.

--cacert <文件>

(TLS)告诉curl使用指定的证书文件来验证对等方。该文件可能包含多个CA证书。证书必须为PEM格式。通常,curl是为使用默认文件而构建的,因此通常使用此选项来更改该默认文件。

curl会识别名为“ CURL_CA_BUNDLE”的环境变量(如果已设置),并使用给定的路径作为指向CA证书捆绑包的路径。此选项将覆盖该变量。

Windows版本的curl将自动在名为curl.exe的目录中或当前工作目录中,或PATH的任何文件夹中查找名为“ curl-ca-bundle.crt”的CA certs文件。

如果curl是针对NSS SSL库构建的,则NSS PEM PKCS#11模块(libnsspem.so)需要可用,此选项才能正常工作。

(仅适用于iOS和macOS)如果curl是针对“安全传输”构建的,则支持此选项以实现与其他SSL引擎的向后兼容性,但不应设置此选项。如果未设置该选项,则curl将使用系统和用户“钥匙串”中的证书来验证对等方,这是验证对等方的证书链的首选方法。

(仅Schannel)在Windows 7或更高版本以及libcurl 7.60或更高版本中,Schannel支持此选项。支持此选项,以便与其他SSL引擎向后兼容。相反,建议使用Windows的根证书存储(Schannel的默认设置)。

如果多次使用此选项,则将使用最后一个。

--capath <目录>

(TLS)告诉curl使用指定的证书目录来验证对等方。可以通过用“:”将它们分开来提供多个路径(例如“ path1:path2:path3”)。证书必须为PEM格式,并且如果针对OpenSSL构建curl,则必须已使用OpenSSL随附的c_rehash实用程序处理了目录。如果--cacert文件包含许多CA证书,则使用--capath可以使使用OpenSSL的curl能够比使用--cacert更加有效地进行SSL连接。

如果设置了此选项,则默认的Capath值将被忽略;如果使用了多次,则将使用最后一个值。

--cert-status

(TLS)告诉curl通过使用证书状态请求(也称为OCSP装订)TLS扩展名来验证服务器证书的状态。

如果启用此选项并且服务器发送无效(例如过期)响应,如果响应表明服务器证书已被吊销,或者根本未收到响应,则验证失败。

当前仅在OpenSSL,GnuTLS和NSS后端中实现。

在7.41.0中添加。

--cert-type <类型>

(TLS)告诉curl提供的客户端证书使用的是哪种类型。PEM,DER,ENG和P12是公认的类型。如果未指定,则假定为PEM。

如果多次使用此选项,则将使用最后一个。

另请参见-E,--cert和--key和--key-type。

-E,--cert <证书[:密码]>

(TLS)告诉curl在使用HTTPS,FTPS或其他基于SSL的协议获取文件时使用指定的客户端证书文件。如果使用“安全传输”,则证书必须为PKCS#12格式;如果使用任何其他引擎,则证书必须为PEM格式。如果未指定可选密码,将在终端上查询该密码。请注意,此选项假定一个“证书”文件是私有密钥和客户端证书串联在一起的!请参阅-E,--cert和--key来分别指定它们。

如果curl是针对NSS SSL库构建的,则此选项可以告诉curl在环境变量SSL_DIR(或默认情况下为/ etc / pki / nssdb)定义的NSS数据库中使用的证书的昵称。如果NSS PEM PKCS#11模块(libnsspem.so)可用,则可以加载PEM文件。如果要使用当前目录中的文件,请在文件名前加上“ ./”前缀,以避免与昵称混淆。如果昵称包含“:”,则必须在其前面加上“ \”,这样才能将其识别为密码分隔符。如果昵称包含“ \”,则需要将其转义为“ \\”,以便不能将其识别为转义字符。

如果curl是针对OpenSSL库构建的,并且引擎pkcs11可用,则可以使用PKCS#11 URI(RFC 7512)来指定位于PKCS#11设备中的证书。以“ pkcs11:”开头的字符串将被解释为PKCS#11 URI。如果提供了PKCS#11 URI,则如果未提供则将--engine选项设置为“ pkcs11”,如果未提供则将--cert-type选项设置为“ ENG”。

(仅限iOS和macOS)如果针对Secure Transport构建curl,则证书字符串可以是系统或用户密钥链中的证书/私钥的名称,也可以是PKCS#12编码的证书和私钥的路径。如果要使用当前目录中的文件,请在文件名前加上“ ./”前缀,以避免与昵称混淆。

(仅Schannel)客户端证书必须由证书存储的路径表达式指定。(不支持加载PFX;您可以先将其导入商店。)您可以使用“ <存储位置> \ <存储名称> \ <缩略图>”来引用系统证书存储中的证书,例如“ CurrentUser \ MY \ 934a7ac6f8a5d579285a74fa61e19f23ddfe8d7a”。指纹通常是SHA-1十六进​​制字符串,您可以在证书详细信息中看到。支持以下商店位置:CurrentUser,LocalMachine,CurrentService,Services,CurrentUserGroupPolicy,LocalMachineGroupPolicy,LocalMachineEnterprise。

如果多次使用此选项,则将使用最后一个。

另请参见--cert-type和--key和--key-type。

--ciphers <密码列表>

(TLS)指定在连接中使用哪些密码。密码列表必须指定有效的密码。阅读此URL上的SSL密码列表详细信息:

https://curl.haxx.se/docs/ssl-ciphers.html

如果多次使用此选项,则将使用最后一个。

--compressed-ssh

(SCP SFTP)启用内置SSH压缩。这是一个请求,而不是命令;服务器可能会也可能不会这样做。

在7.56.0中添加。

-压缩

(HTTP)使用curl支持的一种算法请求压缩的响应,并保存未压缩的文档。如果使用此选项,并且服务器发送了不受支持的编码,则curl将报告错误。

-K,-config <文件>

指定一个文本文件以读取curl参数。在文本文件中找到的命令行参数将像在命令行中提供的一样使用。

选项及其参数必须在文件的同一行上指定,并用空格,冒号或等号分隔。可以选择在配置文件中提供长选项名称,而不用双引号引起来,如果这样,则可以将冒号或等号用作分隔符。如果用一或两个破折号指定选项,则选项与其参数之间不能有冒号或等号字符。

如果参数包含空格(或以:或=开头),则参数必须用引号引起来。在双引号中,可以使用以下转义序列:\\,\“,\ t,\ n,\ r和\ v。其他任何字母前面的反斜杠都将被忽略。如果配置行的第一列是'# '字符,该行的其余部分将被视为注释。在配置文件中,每个物理行只能写入一个选项。

将文件名指定为-K,--config为'-',以使curl从stdin读取文件。

请注意,要能够在配置文件中指定URL,您需要使用--url选项来指定它,而不是简单地在其自己的行上编写URL。因此,它可能类似于以下内容:

url =“ https://curl.haxx.se/docs/”

调用curl时,它(除非使用-q,-disable)检查默认配置文件并在找到时使用它。在以下位置按以下顺序检查默认配置文件:

1)curl尝试查找“ home dir”:它首先检查CURL_HOME,然后检查HOME环境变量。如果失败,它将在类似Unix的系统上使用getpwuid()(给定系统中的当前用户,它将返回主目录)。然后,在Windows上,它检查APPDATA变量,或者作为最后的检查'%USERPROFILE%\ Application Data'。

2)在Windows上,如果主目录中没有.curlrc文件,它将检查放置curl可执行文件的同一目录中是否有一个。在类似Unix的系统上,它将仅尝试从确定的主目录中加载.curlrc。

#---示例文件---
#这是一条评论
url =“ example.com”
输出=“ curlhere.html”
用户代理=“ superagent / 1.0”

#并获取另一个URL
url =“ example.com/docs/manpage.html”
-O
Referer =“ http://nowhereatall.example.com/”
#---示例文件的结尾---
可以多次使用此选项来加载多个配置文件。

--connect-timeout <秒数>

允许curl进行连接的最长时间(以秒为单位)。这仅限制了连接阶段,因此,如果curl在给定时间内连接,它将继续-否则将退出。从7.32.0版本开始,此选项接受十进制值。

如果多次使用此选项,则将使用最后一个。

另请参见-m,--max-time。

--connect-to <主机1:端口1:主机2:端口2>

对于对给定的HOST1:PORT1对的请求,请连接到HOST2:PORT2。此选项适用于在特定服务器(例如,服务器群集中的特定群集节点)处定向请求。此选项仅用于建立网络连接。它不会影响用于TLS / SSL(例如SNI,证书验证)或应用程序协议的主机名/端口。“ HOST1”和“ PORT1”可以为空字符串,表示“任何主机/端口”。“ HOST2”和“ PORT2”也可以是空字符串,表示“使用请求的原始主机/端口”。

将为此选项指定的“主机”作为字符串进行比较,因此它需要与请求URL中使用的名称匹配。它可以是数字,例如“ 127.0.0.1”,也可以是完整的主机名,例如“ example.org”。

此选项可以多次使用以添加许多连接规则。

另请参见--resolve和-H,--header。在7.49.0中添加。

-C,--continue-at <偏移>

以给定的偏移量继续/恢复以前的文件传输。给定的偏移量是从源文件的开头算起的确切字节数,然后再将其传输到目标。如果用于上传,则curl不会使用FTP服务器命令SIZE。

使用“ -C-”指示curl自动找出恢复传输的位置/方式。然后,它使用给定的输出/输入文件来解决这一问题。

如果多次使用此选项,则将使用最后一个。

另请参见-r,--range。

-c,--cookie-jar <文件名>

(HTTP)指定完成操作后要卷曲将所有cookie写入哪个文件。在操作结束时,Curl将所有cookie从其内存中的cookie存储区写入给定文件。如果没有已知的cookie,将不会写入任何数据。该文件将使用Netscape cookie文件格式写入。如果将文件名设置为单破折号“-”,则cookie将被写入stdout。

此命令行选项将激活cookie引擎,该引擎进行curl记录并使用cookie。激活它的另一种方法是使用-b,--cookie选项。

如果无法创建或写入cookie罐,则整个curl操作将不会失败,甚至不会清楚地报告错误。使用-v,--verbose将显示警告,但这是您收到的关于这种可能致命的情况的唯一可见反馈。

如果多次使用此选项,将使用最后指定的文件名。

-b,-cookie <数据|文件名>

(HTTP)将数据传递到Cookie标头中的HTTP服务器。可能是先前在“ Set-Cookie:”行中从服务器接收到的数据。数据格式应为“ NAME1 = VALUE1; NAME2 = VALUE2”。

如果参数中未使用“ =”符号,则将其视为从中读取先前存储的cookie的文件名。此选项还会激活cookie引擎,该引擎将使curl记录传入的cookie,如果将其与-L,--location选项结合使用,或者在同一调用中进行多次URL传输,则可能会很方便。如果文件名恰好是减号(“-”),则curl将代替stdin中的内容。

从中读取Cookie的文件格式应为纯HTTP标头(Set-Cookie样式)或Netscape / Mozilla Cookie文件格式。

用-b,--cookie指定的文件仅用作输入。不会将Cookie写入文件。要存储cookie,请使用-c,--cookie-jar选项。

如果使用此选项,请谨慎操作,并且可能会发生多次传输。如果使用NAME1 = VALUE1;格式,或在文件中使用Set-Cookie格式且未指定域,则将针对任何域发送cookie(即使在执行重定向后也是如此),并且服务器设置的cookie不能对其进行修改。如果启用了cookie引擎,并且服务器设置了相同名称的cookie,则在以后的传输中,两者都将发送到该服务器,可能不是您想要的。要解决这些问题,请在Set-Cookie中设置一个域(这样做将包括子域)或使用Netscape格式。

如果多次使用此选项,则将使用最后一个。

用户通常都希望从文件读取cookie并将更新的cookie写入文件,因此在同一命令行中同时使用-b,-cookie和-c,-cookie-jar是很常见的。

--create-dirs

当与-o,--output选项一起使用时,curl将根据需要创建必要的本地目录层次结构。此选项创建使用-o,--output选项提及的目录,仅此而已。如果--output文件名不使用目录,或者它提到的目录已经存在,则不会创建目录。

要在使用FTP或SFTP时创建远程目录,请尝试--ftp-create-dirs。

--crlf

(FTP SMTP)在上载时将LF转换为CRLF。对MVS(OS / 390)有用。

(在7.40.0中添加了SMTP)

--crlfile <文件>

(TLS)使用PEM格式提供一个带有证书吊销列表的文件,该证书吊销列表可以指定要被吊销的对等证书。

如果多次使用此选项,则将使用最后一个。

在7.19.7中添加。

--data-ascii <数据>

(HTTP)这只是-d,--data的别名。

--data-binary <数据>

(HTTP)这将完全按照指定的方式发布数据,而不会进行任何额外处理。

如果您以字母@开头数据,其余应为文件名。数据的发布方式与-d,--data相似,只是保留换行符和回车,并且永远不会进行转换。

与-d一样,--data发送到服务器的默认内容类型为application / x-www-form-urlencoded。如果希望服务器将数据视为任意二进制数据,则将内容类型设置为八位字节流:-H“内容类型:应用程序/八位字节流”。

如果多次使用此选项,则第一个之后的选项将按-d,-- data中所述附加数据。

--data-raw <数据>

(HTTP)这类似于-d,--data发布数据,但不对@字符进行特殊解释。

另请参见-d,--data。在7.43.0中添加。

--data-urlencode <数据>

(HTTP)与其他-d,--data选项类似,它发布数据,但是它执行URL编码。

为了符合CGI,部分应以名称开头,后跟分隔符和内容规范。可以使用以下语法之一将部分传递给curl:

内容

这将使curl URL编码内容并将其继续传递。请小心,以使内容不包含任何=或@符号,因为这将使语法与以下其他情况之一匹配!

=内容

这将使curl URL编码内容并将其继续传递。前面的=符号不包括在数据中。

名称=内容

这将使curl URL编码内容部分并将其继续传递。请注意,名称部分应该已经过URL编码。

@文件名

这将使卷曲加载来自给定文件的数据(包括任何换行符),对该数据进行URL编码并在POST中传递。

名称@文件名

这将使卷曲加载来自给定文件的数据(包括任何换行符),对该数据进行URL编码并在POST中传递。名称部分附加了等号,从而导致name = urlencoded-file-content。请注意,该名称应该已经过URL编码。

另请参见-d,--data和--data-raw。在7.18.0中添加。

-d,--data <数据>

(HTTP)将POST请求中的指定数据发送到HTTP服务器,就像用户填写HTML表单并按Submit按钮时浏览器所做的一样。这将导致curl使用内容类型application / x-www-form-urlencoded将数据传递到服务器。与-F,--form比较。

--data-raw几乎相同,但是对@字符没有特殊的解释。要发布纯二进制数据,应改用--data-binary选项。要对表单字段的值进行URL编码,可以使用--data-urlencode。

如果在同一命令行上多次使用了这些选项中的任何一个,则指定的数据段将与一个分隔的&符号合并在一起。因此,使用'-d name = daniel -d skill = lousy'将生成一个看起来像'name = daniel&skill = lousy'的帖子块。

如果以字母@开头的数据,则其余的应该是从中读取数据的文件名,或者-如果希望curl从stdin中读取数据。也可以指定多个文件。因此,将使用-d,--data @foobar 从名为“ foobar”的文件中发布数据。当--data被告知要从这样的文件中读取时,回车符和换行符将被删除。如果您不希望@字符具有特殊的解释,请使用--data-raw。

另请参见--data-binary和--data-urlencode和--data-raw。此选项将覆盖-F,--form和-I,--head和-T,--upload-file。

--delegation <级别>

(GSS / kerberos)设置LEVEL以告知服务器有关用户凭据的权限。

没有

不允许任何代表团。

政策

仅当在Kerberos服务票证中设置了OK-AS-DELEGATE标志时才委托,这是领域策略的问题。

总是

无条件地允许服务器进行委派。

  • 消化

(HTTP)启用HTTP摘要式身份验证。这是一种身份验证方案,可防止密码以明文形式通过网络发送。将此选项与普通的-u,-- user选项结合使用以设置用户名和密码。

如果多次使用此选项,则仅使用第一个。

另请参见-u,-user和--proxy-digest和--anyauth。此选项将覆盖--basic和--ntlm和--negotiate。

--disable-eprt

(FTP)执行活动的FTP传输时,告诉curl禁止使用EPRT和LPRT命令。通常,Curl通常总是先尝试使用EPRT,然后再使用LPRT,然后再使用PORT,但是使用此选项后,它将立即使用PORT。EPRT和LPRT是原始FTP协议的扩展,可能无法在所有服务器上使用,但与传统的PORT命令相比,它们以更好的方式启用了更多功能。

--eprt可用于再次显式启用EPRT,而--no-eprt是--disable-eprt的别名。

如果使用IPv6访问服务器,则此选项将无效,因为需要EPRT。

禁用EPRT仅会更改活动行为。如果要切换到被动模式,则无需使用-P,--ftp-port或通过--ftp-pasv强制使用。

--disable-epsv

(FTP)(FTP)执行被动FTP传输时,告诉curl禁用EPSV命令的使用。Curl通常总是总是先尝试使用PASV之前的EPSV,但是使用此选项时,它将不会尝试使用EPSV。

--epsv可用于再次显式启用EPSV,而--no-epsv是--disable-epsv的别名。

如果服务器是IPv6主机,则此选项将无效,因为则需要EPSV。

Disabling EPSV only changes the passive behavior. If you want to switch to active mode you need to use -P, --ftp-port.

-q, --disable

If used as the first parameter on the command line, the curlrc config file will not be read and used. See the -K, --config for details on the default config file search path.

--disallow-username-in-url

(HTTP) This tells curl to exit if passed a url containing a username.

See also --proto. Added in 7.61.0.

--dns-interface

(DNS) Tell curl to send outgoing DNS requests through . This option is a counterpart to --interface (which does not affect DNS). The supplied string must be an interface name (not an address).

See also --dns-ipv4-addr and --dns-ipv6-addr. --dns-interface requires that the underlying libcurl was built to support c-ares. Added in 7.33.0.

--dns-ipv4-addr

(DNS) Tell curl to bind to when making IPv4 DNS requests, so that the DNS requests originate from this address. The argument should be a single IPv4 address.

See also --dns-interface and --dns-ipv6-addr. --dns-ipv4-addr requires that the underlying libcurl was built to support c-ares. Added in 7.33.0.

--dns-ipv6-addr

(DNS) Tell curl to bind to when making IPv6 DNS requests, so that the DNS requests originate from this address. The argument should be a single IPv6 address.

See also --dns-interface and --dns-ipv4-addr. --dns-ipv6-addr requires that the underlying libcurl was built to support c-ares. Added in 7.33.0.

--dns-servers

Set the list of DNS servers to be used instead of the system default. The list of IP addresses should be separated with commas. Port numbers may also optionally be given as : after each IP address.

--dns-servers requires that the underlying libcurl was built to support c-ares. Added in 7.33.0.

--doh-url

(all) Specifies which DNS-over-HTTPS (DOH) server to use to resolve hostnames, instead of using the default name resolver mechanism. The URL must be HTTPS.

如果多次使用此选项,则将使用最后一个。

在7.62.0中添加。

-D,--dump-header <文件名>

(HTTP FTP)将收到的协议标头写入指定的文件。

当您要存储HTTP站点发送给您的标头时,可以方便地使用此选项。然后可以使用-b,--cookie选项在第二次curl调用中读取标题中的cookie!该-c,--cookie-JAR的选择是存储cookies一种更好的方式。

如果没有收到头,则使用此选项将创建一个空文件。

当用于FTP中时,FTP服务器响应行被视为“标头”,因此保存在此处。

如果多次使用此选项,则将使用最后一个。

另请参见-o,--output。

--egd-file <文件>

(TLS)指定“熵收集守护程序”套接字的路径名。套接字用于为SSL连接的随机引擎提供种子。

另请参见--random-file。

--engine <名称>

(TLS)选择用于加密操作的OpenSSL加密引擎。使用--engine list可以打印受构建时支持的引擎的列表。请注意,并非所有(或没有)引擎在运行时可用。

--etag-compare <文件>

(HTTP)通过使用提取的ETag发送自定义的If-None-Match标头,此选项对从给定文件中读取的特定ETag发出条件HTTP请求。

为了获得正确的结果,请确保指定的文件仅包含具有所需ETag的一行。空文件被解析为空ETag。

使用选项--etag-save首先保存响应中的ETag,然后使用此选项在后续请求中使用保存的ETag进行比较。

f比较:有两种比较或ETag:弱和强。此选项可以预期,并可以进行比较。

在7.68.0中添加。

--etag-save <文件>

(HTTP)此选项将HTTP ETag保存到指定文件。Etag通常是请求返回的标头的一部分。服务器发送ETag时,必须用双引号将其引起来。此选项提取不带双引号的ETag并将其保存到中。

服务器可以发送以E / W为前缀的一周ETag。不考虑此标识符,仅解析引号之间的相关ETag。

It an ETag wasn't send by the server or it cannot be parsed, and empty file is created.

Added in 7.68.0.

--expect100-timeout

(HTTP) Maximum time in seconds that you allow curl to wait for a 100-continue response when curl emits an Expects: 100-continue header in its request. By default curl will wait one second. This option accepts decimal values! When curl stops waiting, it will continue as if the response has been received.

See also --connect-timeout. Added in 7.47.0.

--fail-early

Fail and exit on the first detected transfer error.

When curl is used to do multiple transfers on the command line, it will attempt to operate on each given URL, one by one. By default, it will ignore errors if there are more URLs given and the last URL's success will determine the error code curl returns. So early failures will be "hidden" by subsequent successful transfers.

Using this option, curl will instead return an error on the first transfer that fails, independent of the amount of URLs that are given on the command line. This way, no transfer failures go undetected by scripts and similar.

This option is global and does not need to be specified for each use of -:, --next.

This option does not imply -f, --fail, which causes transfers to fail due to the server's HTTP status code. You can combine the two options, however note -f, --fail is not global and is therefore contained by -:, --next.

Added in 7.52.0.

-f, --fail

(HTTP) Fail silently (no output at all) on server errors. This is mostly done to better enable scripts etc to better deal with failed attempts. In normal cases when an HTTP server fails to deliver a document, it returns an HTML document stating so (which often also describes why and more). This flag will prevent curl from outputting that and return error 22.

This method is not fail-safe and there are occasions where non-successful response codes will slip through, especially when authentication is involved (response codes 401 and 407).

--false-start

(TLS) Tells curl to use false start during the TLS handshake. False start is a mode where a TLS client will start sending application data before verifying the server's Finished message, thus saving a round trip when performing a full handshake.

This is currently only implemented in the NSS and Secure Transport (on iOS 7.0 or later, or OS X 10.9 or later) backends.

Added in 7.42.0.

--form-string

(HTTP SMTP IMAP) Similar to -F, --form except that the value string for the named parameter is used literally. Leading '@' and '<' characters, and the ';type=' string in the value have no special meaning. Use this in preference to -F, --form if there's any possibility that the string value may accidentally trigger the '@' or '<' features of -F, --form.

See also -F, --form.

-F, --form

(HTTP SMTP IMAP) For HTTP protocol family, this lets curl emulate a filled-in form in which a user has pressed the submit button. This causes curl to POST data using the Content-Type multipart/form-data according to RFC 2388.

For SMTP and IMAP protocols, this is the mean to compose a multipart mail message to transmit.

This enables uploading of binary files etc. To force the 'content' part to be a file, prefix the file name with an @ sign. To just get the content part from a file, prefix the file name with the symbol <. The difference between @ and < is then that @ makes a file get attached in the post as a file upload, while the < makes a text field and just get the contents for that text field from a file.

Tell curl to read content from stdin instead of a file by using - as filename. This goes for both @ and < constructs. When stdin is used, the contents is buffered in memory first by curl to determine its size and allow a possible resend. Defining a part's data from a named non-regular file (such as a named pipe or similar) is unfortunately not subject to buffering and will be effectively read at transmission time; since the full size is unknown before the transfer starts, such data is sent as chunks by HTTP and rejected by IMAP.

Example: send an image to an HTTP server, where 'profile' is the name of the form-field to which the file portrait.jpg will be the input:

curl -F profile=@portrait.jpg https://example.com/upload.cgi

Example: send a your name and shoe size in two text fields to the server:

curl -F name=John -F shoesize=11 https://example.com/

Example: send a your essay in a text field to the server. Send it as a plain text field, but get the contents for it from a local file:

curl -F "story=<hugefile.txt" https://example.com/

You can also tell curl what Content-Type to use by using 'type=', in a manner similar to:

curl -F "web=@index.html;type=text/html" example.com

or

curl -F "name=daniel;type=text/foo" example.com

You can also explicitly change the name field of a file upload part by setting filename=, like this:

curl -F "file=@localfile;filename=nameinpost" example.com

If filename/path contains ',' or ';', it must be quoted by double-quotes like:

curl -F "file=@\"localfile\";filename=\"nameinpost\"" example.com

or

curl -F 'file=@"localfile";filename="nameinpost"' example.com

Note that if a filename/path is quoted by double-quotes, any double-quote or backslash within the filename must be escaped by backslash.

Quoting must also be applied to non-file data if it contains semicolons, leading/trailing spaces or leading double quotes:

curl -F 'colors="red; green; blue";type=text/x-myapp' example.com

You can add custom headers to the field by setting headers=, like

curl -F "submit=OK;headers=\"X-submit-type: OK\"" example.com

or

curl -F "submit=OK;headers=@headerfile" example.com

The headers= keyword may appear more that once and above notes about quoting apply. When headers are read from a file, Empty lines and lines starting with '#' are comments and ignored; each header can be folded by splitting between two words and starting the continuation line with a space; embedded carriage-returns and trailing spaces are stripped. Here is an example of a header file contents:

# This file contain two headers.
X-header-1: this is a header

# The following header is folded.
X-header-2: this is
another header

To support sending multipart mail messages, the syntax is extended as follows:

  • name can be omitted: the equal sign is the first character of the argument,
  • if data starts with '(', this signals to start a new multipart: it can be followed by a content type specification.
  • a multipart can be terminated with a '=)' argument.

Example: the following command sends an SMTP mime e-mail consisting in an inline part in two alternative formats: plain text and HTML. It attaches a text file:

curl -F '=(;type=multipart/alternative' \
-F '=plain text message' \
-F '= HTML message;type=text/html' \
-F '=)' -F '=@textfile.txt' … smtp://example.com

Data can be encoded for transfer using encoder=. Available encodings are binary and 8bit that do nothing else than adding the corresponding Content-Transfer-Encoding header, 7bit that only rejects 8-bit characters with a transfer error, quoted-printable and base64 that encodes data according to the corresponding schemes, limiting lines length to 76 characters.

Example: send multipart mail with a quoted-printable text message and a base64 attached file:

curl -F '=text message;encoder=quoted-printable' \
-F '=@localfile;encoder=base64' … smtp://example.com

See further examples and details in the MANUAL.

This option can be used multiple times.

This option overrides -d, --data and -I, --head and -T, --upload-file.

--ftp-account

(FTP) When an FTP server asks for "account data" after user name and password has been provided, this data is sent off using the ACCT command.

If this option is used several times, the last one will be used.

Added in 7.13.0.

--ftp-alternative-to-user

(FTP) If authenticating with the USER and PASS commands fails, send this command. When connecting to Tumbleweed's Secure Transport server over FTPS using a client certificate, using "SITE AUTH" will tell the server to retrieve the username from the certificate.

Added in 7.15.5.

--ftp-create-dirs

(FTP SFTP) When an FTP or SFTP URL/operation uses a path that doesn't currently exist on the server, the standard behavior of curl is to fail. Using this option, curl will instead attempt to create missing directories.

See also --create-dirs.

--ftp-method

(FTP) Control what method curl should use to reach a file on an FTP(S) server. The method argument should be one of the following alternatives:

multicwd

curl does a single CWD operation for each path part in the given URL. For deep hierarchies this means very many commands. This is how RFC 1738 says it should be done. This is the default but the slowest behavior.

nocwd

curl does no CWD at all. curl will do SIZE, RETR, STOR etc and give a full path to the server for all these commands. This is the fastest behavior.

singlecwd

curl does one CWD with the full target directory and then operates on the file "normally" (like in the multicwd case). This is somewhat more standards compliant than 'nocwd' but without the full penalty of 'multicwd'.

Added in 7.15.1.

--ftp-pasv

(FTP) Use passive mode for the data connection. Passive is the internal default behavior, but using this option can be used to override a previous -P, --ftp-port option.

If this option is used several times, only the first one is used. Undoing an enforced passive really isn't doable but you must then instead enforce the correct -P, --ftp-port again.

Passive mode means that curl will try the EPSV command first and then PASV, unless --disable-epsv is used.

See also --disable-epsv. Added in 7.11.0.

-P, --ftp-port

(FTP) Reverses the default initiator/listener roles when connecting with FTP. This option makes curl use active mode. curl then tells the server to connect back to the client's specified address and port, while passive mode asks the server to setup an IP address and port for it to connect to.

should be one of:

interface

e.g. "eth0" to specify which interface's IP address you want to use (Unix only)

IP address

e.g. "192.168.10.1" to specify the exact IP address

host name

e.g. "my.host.domain" to specify the machine

-

make curl pick the same IP address that is already used for the control connection

If this option is used several times, the last one will be used. Disable the use of PORT with --ftp-pasv. Disable the attempt to use the EPRT command instead of PORT by using --disable-eprt. EPRT is really PORT++.

Since 7.19.5, you can append ":[start]-[end]" to the right of the address, to tell curl what TCP port range to use. That means you specify a port range, from a lower to a higher number. A single number works as well, but do note that it increases the risk of failure since the port may not be available.

See also --ftp-pasv and --disable-eprt.

--ftp-pret

(FTP) Tell curl to send a PRET command before PASV (and EPSV). Certain FTP servers, mainly drftpd, require this non-standard command for directory listings as well as up and downloads in PASV mode.

Added in 7.20.0.

--ftp-skip-pasv-ip

(FTP) Tell curl to not use the IP address the server suggests in its response to curl's PASV command when curl connects the data connection. Instead curl will re-use the same IP address it already uses for the control connection.

This option has no effect if PORT, EPRT or EPSV is used instead of PASV.

See also --ftp-pasv. Added in 7.14.2.

--ftp-ssl-ccc-mode

(FTP) Sets the CCC mode. The passive mode will not initiate the shutdown, but instead wait for the server to do it, and will not reply to the shutdown from the server. The active mode initiates the shutdown and waits for a reply from the server.

See also --ftp-ssl-ccc. Added in 7.16.2.

--ftp-ssl-ccc

(FTP) Use CCC (Clear Command Channel) Shuts down the SSL/TLS layer after authenticating. The rest of the control channel communication will be unencrypted. This allows NAT routers to follow the FTP transaction. The default mode is passive.

See also --ssl and --ftp-ssl-ccc-mode. Added in 7.16.1.

--ftp-ssl-control

(FTP) Require SSL/TLS for the FTP login, clear for transfer. Allows secure authentication, but non-encrypted data transfers for efficiency. Fails the transfer if the server doesn't support SSL/TLS.

Added in 7.16.0.

-G, --get

When used, this option will make all data specified with -d, --data, --data-binary or --data-urlencode to be used in an HTTP GET request instead of the POST request that otherwise would be used. The data will be appended to the URL with a '?' separator.

If used in combination with -I, --head, the POST data will instead be appended to the URL with a HEAD request.

If this option is used several times, only the first one is used. This is because undoing a GET doesn't make sense, but you should then instead enforce the alternative method you prefer.

-g, --globoff

This option switches off the "URL globbing parser". When you set this option, you can specify URLs that contain the letters {}[] without having them being interpreted by curl itself. Note that these letters are not normal legal URL contents but they should be encoded according to the URI standard.

--happy-eyeballs-timeout-ms

Happy eyeballs is an algorithm that attempts to connect to both IPv4 and IPv6 addresses for dual-stack hosts, preferring IPv6 first for the number of milliseconds. If the IPv6 address cannot be connected to within that time then a connection attempt is made to the IPv4 address in parallel. The first connection to be established is the one that is used.

The range of suggested useful values is limited. Happy Eyeballs RFC 6555 says "It is RECOMMENDED that connection attempts be paced 150-250 ms apart to balance human factors against network load." libcurl currently defaults to 200 ms. Firefox and Chrome currently default to 300 ms.

If this option is used several times, the last one will be used.

Added in 7.59.0.

--haproxy-protocol

(HTTP)在连接开始时发送HAProxy PROXY协议v1标头。一些负载平衡器和反向代理使用它来指示客户端的真实IP地址和端口。

将测试请求发送到需要此标头的服务时,此选项主要有用。

在7.60.0中添加。

-我头

(HTTP FTP文件)仅获取标题!HTTP服务器具有命令HEAD,该命令用于获取文档的标头。当在FTP或FILE文件上使用时,curl仅显示文件大小和最后修改时间。

-H,--header <标题/ @文件>

(HTTP)将HTTP发送到服务器时要包含在请求中的额外标头。您可以指定任意数量的额外标题。请注意,如果您要添加一个自定义标头,其名称与curl将使用的内部标头之一相同,则将使用外部设置的标头,而不是内部标头。这使您可以制作比卷发通常更棘手的东西。如果不完全了解自己在做什么,则不应替换内部设置的标题。通过在冒号的右侧给出不包含内容的替换内容来删除内部标头,例如:-H“ Host:”。如果您发送的自定义标头没有值,则其标头必须以分号终止,例如-H“ X-Custom-Header;”。发送“ X-Custom-Header:”。

卷曲将确保每次添加页眉/取而代之的是与最终的行适当的标记发送,你应该这样不添加作为标题内容的一部分:不添加新行或者回车,他们只会误事为您服务。

从7.55.0开始,此选项可以采用@filename样式的参数,然后为输入文件中的每一行添加一个标题。使用@-将使curl从stdin读取头文件。

另请参见-A,-- user -agent和-e,--referer选项。

从7.37.0开始,您需要--proxy-header发送用于代理的自定义标头。

例:

curl -H“ X-名字:乔” http://example.com/

警告:使用此选项设置的标头将在所有请求中设置-即使在执行重定向之后,如使用-L,--location进行通知时一样。这可能导致将标头发送到原始主机以外的其他主机,因此,应谨慎使用敏感标头,并结合以下重定向。

可以多次使用此选项来添加/替换/删除多个标题。

-h,--help

使用帮助。这列出了所有当前的命令行选项,并带有简短描述。

--hostpubmd5

(SFTP SCP)传递包含32个十六进制数字的字符串。该字符串应为远程主机公钥的128位MD5校验和,除非md5sums匹配,否则curl将拒绝与主机的连接。

在7.17.1中添加。

--http0.9

(HTTP)告诉curl在HTTP 0.9版响应中可以使用。

HTTP/0.9 is a completely headerless response and therefore you can also connect with this to non-HTTP servers and still get a response since curl will simply transparently downgrade - if allowed.

Since curl 7.66.0, HTTP/0.9 is disabled by default.

-0, --http1.0

(HTTP) Tells curl to use HTTP version 1.0 instead of using its internally preferred HTTP version.

This option overrides --http1.1 and --http2.

--http1.1

(HTTP) Tells curl to use HTTP version 1.1.

This option overrides -0, --http1.0 and --http2. Added in 7.33.0.

--http2-prior-knowledge

(HTTP) Tells curl to issue its non-TLS HTTP requests using HTTP/2 without HTTP/1.1 Upgrade. It requires prior knowledge that the server supports HTTP/2 straight away. HTTPS requests will still do HTTP/2 the standard way with negotiated protocol version in the TLS handshake.

--http2-prior-knowledge requires that the underlying libcurl was built to support HTTP/2. This option overrides --http1.1 and -0, --http1.0 and --http2. Added in 7.49.0.

--http2

(HTTP) Tells curl to use HTTP version 2.

See also --http1.1 and --http3. --http2 requires that the underlying libcurl was built to support HTTP/2. This option overrides --http1.1 and -0, --http1.0 and --http2-prior-knowledge. Added in 7.33.0.

--http3

(HTTP) WARNING: this option is experimental. Do not use in production.

Tells curl to use HTTP version 3 directly to the host and port number used in the URL. A normal HTTP/3 transaction will be done to a host and then get redirected via Alt-SVc, but this option allows a user to circumvent that when you know that the target speaks HTTP/3 on the given host and port.

This option will make curl fail if a QUIC connection cannot be established, it cannot fall back to a lower HTTP version on its own.

See also --http1.1 and --http2. --http3 requires that the underlying libcurl was built to support HTTP/3. This option overrides --http1.1 and -0, --http1.0 and --http2 and --http2-prior-knowledge. Added in 7.66.0.

--ignore-content-length

(FTP HTTP) For HTTP, Ignore the Content-Length header. This is particularly useful for servers running Apache 1.x, which will report incorrect Content-Length for files larger than 2 gigabytes.

For FTP (since 7.46.0), skip the RETR command to figure out the size before downloading a file.

-i, --include

Include the HTTP response headers in the output. The HTTP response headers can include things like server name, cookies, date of the document, HTTP version and more…

To view the request headers, consider the -v, --verbose option.

See also -v, --verbose.

-k, --insecure

(TLS) By default, every SSL connection curl makes is verified to be secure. This option allows curl to proceed and operate even for server connections otherwise considered insecure.

The server connection is verified by making sure the server's certificate contains the right name and verifies successfully using the cert store.

See this online resource for further details: https://curl.haxx.se/docs/sslcerts.html

See also --proxy-insecure and --cacert.

--interface

Perform an operation using a specified interface. You can enter interface name, IP address or host name. An example could look like:

curl --interface eth0:1 https://www.example.com/

If this option is used several times, the last one will be used.

On Linux it can be used to specify a VRF, but the binary needs to either have CAP_NET_RAW or to be run as root. More information about Linux VRF: https://www.kernel.org/doc/Documentation/networking/vrf.txt

See also --dns-interface.

-4, --ipv4

This option tells curl to resolve names to IPv4 addresses only, and not for example try IPv6.

See also --http1.1 and --http2. This option overrides -6, --ipv6.

-6, --ipv6

This option tells curl to resolve names to IPv6 addresses only, and not for example try IPv4.

See also --http1.1 and --http2. This option overrides -4, --ipv4.

-j, --junk-session-cookies

(HTTP) When curl is told to read cookies from a given file, this option will make it discard all "session cookies". This will basically have the same effect as if a new session is started. Typical browsers always discard session cookies when they're closed down.

See also -b, --cookie and -c, --cookie-jar.

--keepalive-time

This option sets the time a connection needs to remain idle before sending keepalive probes and the time between individual keepalive probes. It is currently effective on operating systems offering the TCP_KEEPIDLE and TCP_KEEPINTVL socket options (meaning Linux, recent AIX, HP-UX and more). This option has no effect if --no-keepalive is used.

If this option is used several times, the last one will be used. If unspecified, the option defaults to 60 seconds.

Added in 7.18.0.

--key-type

(TLS) Private key file type. Specify which type your --key provided private key is. DER, PEM, and ENG are supported. If not specified, PEM is assumed.

If this option is used several times, the last one will be used.

--key

(TLS SSH) Private key file name. Allows you to provide your private key in this separate file. For SSH, if not specified, curl tries the following candidates in order: '~/.ssh/id_rsa', '~/.ssh/id_dsa', './id_rsa', './id_dsa'.

If curl is built against OpenSSL library, and the engine pkcs11 is available, then a PKCS#11 URI (RFC 7512) can be used to specify a private key located in a PKCS#11 device. A string beginning with "pkcs11:" will be interpreted as a PKCS#11 URI. If a PKCS#11 URI is provided, then the --engine option will be set as "pkcs11" if none was provided and the --key-type option will be set as "ENG" if none was provided.

If this option is used several times, the last one will be used.

--krb

(FTP) Enable Kerberos authentication and use. The level must be entered and should be one of 'clear', 'safe', 'confidential', or 'private'. Should you use a level that is not one of these, 'private' will instead be used.

If this option is used several times, the last one will be used.

--krb requires that the underlying libcurl was built to support Kerberos.

--libcurl

Append this option to any ordinary curl command line, and you will get a libcurl-using C source code written to the file that does the equivalent of what your command-line operation does!

If this option is used several times, the last given file name will be used.

Added in 7.16.1.

--limit-rate

Specify the maximum transfer rate you want curl to use - for both downloads and uploads. This feature is useful if you have a limited pipe and you'd like your transfer not to use your entire bandwidth. To make it slower than it otherwise would be.

The given speed is measured in bytes/second, unless a suffix is appended. Appending 'k' or 'K' will count the number as kilobytes, 'm' or 'M' makes it megabytes, while 'g' or 'G' makes it gigabytes. Examples: 200K, 3m and 1G.

If you also use the -Y, --speed-limit option, that option will take precedence and might cripple the rate-limiting slightly, to help keeping the speed-limit logic working.

If this option is used several times, the last one will be used.

-l, --list-only

(FTP POP3) (FTP) When listing an FTP directory, this switch forces a name-only view. This is especially useful if the user wants to machine-parse the contents of an FTP directory since the normal directory view doesn't use a standard look or format. When used like this, the option causes a NLST command to be sent to the server instead of LIST.

Note: Some FTP servers list only files in their response to NLST; they do not include sub-directories and symbolic links.

(POP3) When retrieving a specific email from POP3, this switch forces a LIST command to be performed instead of RETR. This is particularly useful if the user wants to see if a specific message id exists on the server and what size it is.

Note: When combined with -X, --request, this option can be used to send an UIDL command instead, so the user may use the email's unique identifier rather than it's message id to make the request.

Added in 7.21.5.

--local-port

Set a preferred single number or range (FROM-TO) of local port numbers to use for the connection(s). Note that port numbers by nature are a scarce resource that will be busy at times so setting this range to something too narrow might cause unnecessary connection setup failures.

Added in 7.15.2.

--location-trusted

(HTTP) Like -L, --location, but will allow sending the name + password to all hosts that the site may redirect to. This may or may not introduce a security breach if the site redirects you to a site to which you'll send your authentication info (which is plaintext in the case of HTTP Basic authentication).

See also -u, --user.

-L, --location

(HTTP) If the server reports that the requested page has moved to a different location (indicated with a Location: header and a 3XX response code), this option will make curl redo the request on the new place. If used together with -i, --include or -I, --head, headers from all requested pages will be shown. When authentication is used, curl only sends its credentials to the initial host. If a redirect takes curl to a different host, it won't be able to intercept the user+password. See also --location-trusted on how to change this. You can limit the amount of redirects to follow by using the --max-redirs option.

当curl跟随重定向并且请求不是简单的GET(例如POST或PUT)时,如果HTTP响应是301、302或303,它将使用GET执行以下请求。如果响应代码是其他3xx代码,curl将使用相同的未修改方法重新发送以下请求。

您可以通过使用--post301,-- post302和--post303的专用选项,告诉curl在30x响应后不要将非GET请求方法更改为GET 。

--login-options <选项>

(IMAP POP3 SMTP)指定在服务器身份验证期间使用的登录选项。

您可以使用登录选项来指定身份验证期间可能使用的协议特定选项。目前,只有IMAP,POP3和SMTP支持登录选项。有关登录选项的更多信息,请参阅RFC 2384,RFC 5092和IETF草案draft-earhart-url-smtp-00.txt

如果多次使用此选项,则将使用最后一个。

在7.34.0中添加。

--mail-auth <地址>

(SMTP)指定一个地址。这将用于指定正在中继到另一台服务器的已提交消息的认证地址(身份)。

另请参阅--mail-rcpt和--mail-from。在7.25.0中添加。

--mail-from <地址>

(SMTP)指定应该从其发送给定邮件的单个地址。

另请参阅--mail-rcpt和--mail-auth。在7.20.0中添加。

--mail-rcpt <地址>

(SMTP)指定一个地址,用户名或邮件列表名称。重复此选项几次以发送给多个收件人。

执行邮件传输时,收件人应指定一个有效的电子邮件地址以将邮件发送到。

执行地址验证(VRFY命令)时,应将收件人指定为用户名或用户名和域(根据RFC 5321的 3.5节)。(在7.34.0中添加)

执行邮件列表扩展(EXPN命令)时,应使用邮件列表名称指定收件人,例如“ Friends”或“ London-Office”。(在7.34.0中添加)

在7.20.0中添加。

-M,-手动

手册。显示巨大的帮助文本。

--max-filesize <字节>

指定要下载的文件的最大大小(以字节为单位)。如果请求的文件大于此值,则传输将不会开始,并且curl将返回退出代码63。

可以使用尺寸修改器。例如,追加“ k”或“ K”会将数字计为千字节,“ m”或“ M”将其计为兆字节,而“ g”或“ G”将计为千兆字节。示例:200K,3m和1G。(在7.58.0中添加)

注意:文件大小在下载之前并不总是已知的,并且对于此类文件,即使文件传输最终大于此给定限制,此选项也无效。这涉及FTP和HTTP传输。

另请参阅--limit-rate。

--max-redirs <数字>

(HTTP) Set maximum number of redirection-followings allowed. When -L, --location is used, is used to prevent curl from following redirections too much. By default, the limit is set to 50 redirections. Set this option to -1 to make it unlimited.

If this option is used several times, the last one will be used.

-m, --max-time

Maximum time in seconds that you allow the whole operation to take. This is useful for preventing your batch jobs from hanging for hours due to slow networks or links going down. Since 7.32.0, this option accepts decimal values, but the actual timeout will decrease in accuracy as the specified timeout increases in decimal precision.

If this option is used several times, the last one will be used.

See also --connect-timeout.

--metalink

This option can tell curl to parse and process a given URI as Metalink file (both version 3 and 4 (RFC 5854) are supported) and make use of the mirrors listed within for failover if there are errors (such as the file or server not being available). It will also verify the hash of the file after the download completes. The Metalink file itself is downloaded and processed in memory and not stored in the local file system.

Example to use a remote Metalink file:

curl --metalink http://www.example.com/example.metalink

To use a Metalink file in the local file system, use FILE protocol (file://):

curl --metalink file://example.metalink

Please note that if FILE protocol is disabled, there is no way to use a local Metalink file at the time of this writing. Also note that if --metalink and -i, --include are used together, --include will be ignored. This is because including headers in the response will break Metalink parser and if the headers are included in the file described in Metalink file, hash check will fail.

--metalink requires that the underlying libcurl was built to support metalink. Added in 7.27.0.

--negotiate

(HTTP) Enables Negotiate (SPNEGO) authentication.

This option requires a library built with GSS-API or SSPI support. Use -V, --version to see if your curl supports GSS-API/SSPI or SPNEGO.

When using this option, you must also provide a fake -u, --user option to activate the authentication code properly. Sending a '-u :' is enough as the user name and password from the -u, --user option aren't actually used.

If this option is used several times, only the first one is used.

See also --basic and --ntlm and --anyauth and --proxy-negotiate.

--netrc-file

此选项与-n,--netrc相似,除了您提供curl应该使用的netrc文件的路径(绝对路径或相对路径)。每次调用只能指定一个netrc文件。如果提供了多个--netrc-file选项,则将使用最后一个。

如果指定,它将遵守--netrc-optional。

此选项将覆盖-n,--netrc。在7.21.5中添加。

--netrc-可选

与-n --netrc非常相似,但是此选项使.netrc用法成为可选的,而不是像-n,--netrc选项那样强制。

另请参见--netrc-file。此选项将覆盖-n,--netrc。

-n,-netrc

使curl扫描用户主目录中的.netrc(在Windows上为_netrc)文件,以获取登录名和密码。通常在Unix上用于FTP。如果与HTTP一起使用,curl将启用用户身份验证。有关文件格式的详细信息,请参见netrc(5) ftp(1)。如果该文件没有正确的权限,Curl不会抱怨(该文件不能被世界或组读取)。环境变量“ HOME”用于查找主目录。

一个简单而快速的示例,说明如何设置.netrc以允许使用用户名“ myself”和密码“ secret”的FTP卷曲到计算机host.domain.com。

机器host.domain.com登录我自己密码机密

-:, - 下一个

告诉curl为以下URL和关联的选项使用单独的操作。这样,您可以发送多个URL请求,每个URL请求都有其自己的特定选项,例如,不同的用户名或自定义请求。

-:, --next将重置所有本地选项,并且只有全局选项的值才会保留到-:, --next指令之后的操作中。全局选项包括-v,--verbose,--trace,--trace-ascii码和--fail早期。

例如,您可以在单个命令行中同时执行G​​ET和POST:

卷曲www1.example.com --next -d postthis www2.example.com

在7.36.0中添加。

--no-alpn

(HTTPS)禁用ALPN TLS扩展。如果libcurl是使用支持ALPN的SSL库构建的,则默认情况下会启用ALPN。支持HTTP / 2的libcurl使用ALPN在https会话期间与服务器协商HTTP / 2支持。

另请参见--no-npn和--http2。--no-alpn要求基础libcurl构建为支持TLS。在7.36.0中添加。

-N,-无缓冲

禁用输出流的缓冲。在正常工作情况下,curl将使用标准的缓冲输出流,其效果将是将数据分块输出,而不一定是数据到达时精确输出。使用此选项将禁用该缓冲。

请注意,这是记录的否定的选项名称。因此,您可以使用--buffer强制执行缓冲。

--no-keepalive

禁止在TCP连接上使用keepalive消息。curl否则默认启用它们。

请注意,这是记录的否定的选项名称。因此,您可以使用--keepalive强制执行keepalive。

--no-npn

(HTTPS)禁用NPN TLS扩展。如果libcurl是使用支持NPN的SSL库构建的,则默认情况下会启用NPN。支持HTTP / 2的libcurl使用NPN在https会话期间与服务器协商HTTP / 2支持。

另请参见--no-alpn和--http2。--no-npn要求基础libcurl构建为支持TLS。在7.36.0中添加。

-无进度表

关闭进程表输出的选项,而不会静音或以其他方式影响警告和信息性消息,例如-s,-silent会。

请注意,这是记录的否定的选项名称。因此,您可以使用--progress-meter再次启用进度表。

另请参见-v,-verbose和-s,-silent。在7.67.0中添加。

--no-sessionid

(TLS)禁用curl对SSL会话ID缓存的使用。默认情况下,所有传输都使用缓存完成。请注意,尽管尝试重用SSL会话ID不会受到任何伤害,但似乎有一些荒谬的SSL实施可能需要您禁用它才能成功。

请注意,这是记录的否定的选项名称。因此,您可以使用--sessionid强制执行会话ID缓存。

在7.16.0中添加。

--noproxy <无代理列表>

如果未指定,则以逗号分隔的不使用代理的主机列表。唯一的通配符是单个*字符,该字符与所有主机匹配,并有效地禁用了代理。此列表中的每个名称都将作为包含主机名的域或主机名本身进行匹配。例如,local.com将匹配local.com,local.com:80和www.local.com,但不匹配www.notlocal.com。

从7.53.0开始,此选项将覆盖禁用代理的环境变量。如果存在禁用代理的环境变量,则可以将noproxy list设置为“”以覆盖它。

在7.19.4中添加。

--ntlm-wb

(HTTP)以--ntlm的样式启用NTLM ,但是将身份验证移交给了单独的二进制ntlmauth应用程序,该应用程序在需要时执行。

另请参见--ntlm和--proxy-ntlm。

--ntlm

(HTTP)启用NTLM身份验证。NTLM身份验证方法由Microsoft设计,并由IIS Web服务器使用。它是一种专有协议,由聪明的人进行逆向工程,并根据他们的努力以卷曲方式实现。这种行为不应被认可,您应该鼓励每个使用NTLM的人改用公开的和有文件证明的身份验证方法,例如Digest。

如果要为代理身份验证启用NTLM,请使用--proxy-ntlm。

如果多次使用此选项,则仅使用第一个。

另请参见--proxy-ntlm。--ntlm要求基础libcurl构建为支持TLS。此选项将覆盖--basic和--negotiate和--digest和--anyauth。

--oauth2-bearer <令牌>

(IMAP POP3 SMTP)指定用于OAUTH 2.0服务器身份验证的承载令牌。不记名令牌与用户名结合使用,用户名可以在--url或-u,--user选项中指定。

承载令牌和用户名根据RFC 6750格式化。

如果多次使用此选项,则将使用最后一个。

-o,--output <文件>

将输出写到而不是stdout。如果使用{}或[]来获取多个文档,则可以使用'#',后跟说明符中的数字。该变量将被要获取的URL的当前字符串替换。像:

卷曲http:// {one,two} .example.com -o“ file_#1.txt”

或使用几个变量,例如:

curl http:// {site,host} .host [1-5] .com -o“#1_#2”

您可以使用此选项的次数与您拥有的URL数量一样多。例如,如果在同一命令行上指定两个URL,则可以这样使用它:

curl -o a example.com -o bb example.net

并且-o选项和URL的顺序无关紧要,只是第一个-o用于第一个URL,依此类推,因此上述命令行也可以写成

curl example.com example.net -o aa -o bb

另请参见--create-dirs选项以动态创建本地目录。将输出指定为“-”(单破折号)将强制将输出完成为stdout。

另请参见-O,--remote-name和--remote-name-all和-J,--remote-header-name。

-平行立即

在执行并行传输时,此选项将指示curl,它宁愿一次并行打开更多连接,而不是等待是否可以将新传输作为多路复用流添加到另一个连接上。

另请参见-Z,--parallel和--parallel-max。在7.68.0中添加。

-平行最大

当要求使用-Z,--parallel进行并行传输时,此选项控制同时执行的最大传输量。

默认值为50。

另请参见-Z,--parallel。在7.66.0中添加。

-Z,--parallel

与常规串行方式相比,使curl并行执行其传输。

在7.66.0中添加。

--pass <短语>

(SSH TLS)专用密钥密码

如果多次使用此选项,则将使用最后一个。

-按原样

告诉curl不要在给定的URL路径中处理/../或/./的序列。通常,curl将根据标准压缩或合并它们,但是设置此选项后,您告诉它不要这样做。

在7.42.0中添加。

--pinnedpubkey <哈希>

(TLS)告诉curl使用指定的公共密钥文件(或哈希)来验证对等方。该路径可以是文件的路径,该文件包含单个PEM或DER格式的公钥,或者是任意数量的以“ sha256 //”开头并以“;”分隔的base64编码的sha256哈希。

协商TLS或SSL连接时,服务器将发送一个证书以表明其身份。从此证书中提取了一个公钥,如果它与提供给此选项的公钥不完全匹配,curl将在发送或接收任何数据之前中止连接。

PEM / DER支持:7.39.0:OpenSSL,GnuTLS和GSKit 7.43.0:NSS和wolfSSL 7.47.0:mbedtls sha256支持:7.44.0:OpenSSL,GnuTLS,NSS和wolfSSL 7.47.0:mbedtls不支持其他SSL后端。

如果多次使用此选项,则将使用最后一个。

--post301

(HTTP)告诉curl 在遵循301重定向时遵守RFC 7231 /6.4.2,不要将POST请求转换为GET请求。非RFC行为在Web浏览器中无处不在,因此curl默认情况下会进行转换以保持一致性。但是,服务器可能需要POST才能在此类重定向后保留POST。仅当使用-L,--location时,此选项才有意义。

另请参阅--post302和--post303和-L,--location。在7.17.1中添加。

--post302

(HTTP)告诉curl遵循RFC 7231 /6.4.3,并且在遵循302重定向时不将POST请求转换为GET请求。非RFC行为在Web浏览器中无处不在,因此curl默认情况下会进行转换以保持一致性。但是,服务器可能需要POST才能在此类重定向后保留POST。仅当使用-L,--location时,此选项才有意义。

另请参阅--post301和--post303和-L,--location。在7.19.1中添加。

--post303

(HTTP)告诉curl 在遵循303重定向时违反RFC 7231 /6.4.4,并且不将POST请求转换为GET请求。服务器可能要求POST在303重定向后保持为POST。仅当使用-L,--location时,此选项才有意义。

另请参阅--post302和--post301和-L,--location。在7.26.0中添加。

--preproxy [protocol://] host [:port]

连接到HTTP或HTTPS -x,-- proxy之前,请使用指定的SOCKS代理。在这种情况下,curl首先连接到SOCKS代理,然后(通过SOCKS)连接到HTTP或HTTPS代理。因此,预代理。

前置代理字符串应使用protocol://前缀指定,以指定备用代理协议。使用socks4://,socks4a://,socks5://或socks5h://来请求要使用的特定SOCKS版本。未指定任何协议会使curl默认为SOCKS4。

如果未在代理字符串中指定端口号,则假定为1080。

代理字符串中可能提供的用户名和密码通过curl进行URL解码。这使您可以使用%40传递特殊字符(例如@),或使用%3a传递冒号。

如果多次使用此选项,则将使用最后一个。

在7.52.0中添加。

-#, - 进度条

使curl显示传输进度作为一个简单的进度条,而不是标准的,更多信息的仪表。

此进度条在屏幕上绘制一行“#”字符,如果知道传输大小,则显示百分比。对于未知大小的传输,将有来回移动的太空飞船(-= o =-),但仅在传输数据时,顶部带有一组飞行的哈希符号。

--proto-default <协议>

告诉curl对缺少方案名称的任何URL 使用协议。

例:

curl --proto-default https ftp.mozilla.org

未知或不受支持的协议会导致错误CURLE_UNSUPPORTED_PROTOCOL(1)。

此选项不会更改默认代理协议(http)。

如果没有此选项,curl将根据主机进行猜测,有关详细信息,请参见--url。

在7.45.0中添加。

--proto-redir <协议>

告诉curl限制其在重定向上可以使用的协议。该选项不会覆盖--proto拒绝的协议。有关如何表示协议的信息,请参见--proto。

例如,仅允许HTTP和HTTPS进行重定向:

curl --proto-redir -all,http,https http://example.com

默认情况下,curl将允许HTTP,HTTPS,FTP和FTPS重定向(7.65.2)。较早版本的curl允许所有重定向协议,但出于安全原因禁用了几个协议:由于7.19.4 FILE和SCP被禁用,并且7.40.0 SMB和SMBS也被禁用。指定all或+ all将启用所有重定向协议,包括为安全而禁用的协议。

在7.20.2中添加。

--proto <协议>

告诉curl限制它可以在传输中使用的协议。协议从左到右进行评估,以逗号分隔,并且每个协议都是协议名称或“全部”,可以选择以零个或多个修饰符为前缀。可用的修饰语有:

+除了已经允许的协议之外,还允许该协议(如果不使用修饰符,则为默认设置)。

-拒绝此协议,将其从已允许的协议列表中删除。

=仅允许使用此协议(忽略已允许的列表),但以后可以通过逗号分隔列表中的后续条目进行修改。

例如:

--proto -ftps使用默认协议,但禁用ftps

--proto -all,https,+ http仅启用http和https

--proto = http,https也仅启用http和https

未知协议会产生警告。这允许脚本安全地依赖能够禁用潜在危险协议,而不必依赖于curl中内置的对该协议的支持来避免错误。

此选项可以多次使用,在这种情况下,其效果与将协议串联到该选项的一个实例中相同。

另请参见--proto-redir和--proto-default。在7.20.2中添加。

--proxy-anyauth

与给定的HTTP代理进行通信时,告诉curl选择一种合适的身份验证方法。这可能会导致额外的请求/响应往返。

另请参见-x,-proxy和--proxy-basic和--proxy-digest。在7.13.2中添加。

--proxy-basic

告诉curl与给定代理进行通信时使用HTTP基本身份验证。使用--basic与远程主机一起启用HTTP Basic。基本是curl与代理一起使用的默认身份验证方法。

另请参见-x,-proxy和--proxy-anyauth和--proxy-digest。

--proxy-cacert <文件>

与--cacert相同,但用于HTTPS代理上下文中。

另请参见--proxy-capath和--cacert和--capath和-x,--proxy。在7.52.0中添加。

--proxy-capath <目录>

与--capath相同,但用于HTTPS代理上下文中。

另请参见--proxy-cacert和-x,--proxy和--capath。在7.52.0中添加。

--proxy-cert-type <类型>

与--cert-type相同,但用于HTTPS代理上下文中。

在7.52.0中添加。

--proxy-cert

与-E,-cert相同,但用于HTTPS代理上下文中。

在7.52.0中添加。

--proxy-ciphers <列表>

与--ciphers相同,但用于HTTPS代理上下文中。

在7.52.0中添加。

--proxy-crlfile <文件>

与--crlfile相同,但用于HTTPS代理上下文中。

在7.52.0中添加。

-代理摘要

Tells curl to use HTTP Digest authentication when communicating with the given proxy. Use --digest for enabling HTTP Digest with a remote host.

See also -x, --proxy and --proxy-anyauth and --proxy-basic.

--proxy-header

(HTTP) Extra header to include in the request when sending HTTP to a proxy. You may specify any number of extra headers. This is the equivalent option to -H, --header but is for proxy communication only like in CONNECT requests when you want a separate header sent to the proxy to what is sent to the actual remote host.

curl will make sure that each header you add/replace is sent with the proper end-of-line marker, you should thus not add that as a part of the header content: do not add newlines or carriage returns, they will only mess things up for you.

Headers specified with this option will not be included in requests that curl knows will not be sent to a proxy.

Starting in 7.55.0, this option can take an argument in @filename style, which then adds a header for each line in the input file. Using @- will make curl read the header file from stdin.

This option can be used multiple times to add/replace/remove multiple headers.

Added in 7.37.0.

--proxy-insecure

Same as -k, --insecure but used in HTTPS proxy context.

Added in 7.52.0.

--proxy-key-type

与--key-type相同,但用于HTTPS代理上下文中。

在7.52.0中添加。

--proxy-key <密钥>

与--key相同,但用于HTTPS代理上下文中。

-代理谈判

告诉curl与给定代理进行通信时使用HTTP协商(SPNEGO)身份验证。使用--negotiate可与远程主机启用HTTP Negotiate(SPNEGO)。

另请参见--proxy-anyauth和--proxy-basic。在7.17.1中添加。

--proxy-ntlm

告诉curl与给定代理进行通信时使用HTTP NTLM身份验证。使用--ntlm可以对远程主机启用NTLM。

另请参见--proxy-negotiate和--proxy-anyauth。

--proxy-pass <短语>

与--pass相同,但用于HTTPS代理上下文中。

在7.52.0中添加。

--proxy-pinnedpubkey <哈希>

(TLS)告诉curl使用指定的公共密钥文件(或哈希)来验证代理。该路径可以是文件的路径,该文件包含单个PEM或DER格式的公钥,或者是任意数量的以“ sha256 //”开头并以“;”分隔的base64编码的sha256哈希。

协商TLS或SSL连接时,服务器将发送一个证书以表明其身份。从此证书中提取了一个公钥,如果它与提供给此选项的公钥不完全匹配,curl将在发送或接收任何数据之前中止连接。

如果多次使用此选项,则将使用最后一个。

--proxy-service-name <名称>

此选项使您可以更改代理协商的服务名称。

在7.43.0中添加。

--proxy-ssl-allow-beast

与--ssl-allow-beast相同,但用于HTTPS代理上下文中。

在7.52.0中添加。

--proxy-tls13-ciphers <密码套件列表>

(TLS)指定在HTTPS代理协商TLS 1.3时在与HTTPS代理的连接中使用的密码套件。密码套件列表必须指定有效的密码。在以下URL上阅读TLS 1.3密码套件详细信息:

https://curl.haxx.se/docs/ssl-ciphers.html

当前仅在将curl构建为使用OpenSSL 1.1.1或更高版本时才使用此选项。如果您使用其他SSL后端,则可以尝试使用--proxy-ciphers选项设置TLS 1.3密码套件。

如果多次使用此选项,则将使用最后一个。

--proxy-tlsauthtype <类型>

Same as --tlsauthtype but used in HTTPS proxy context.

Added in 7.52.0.

--proxy-tlspassword

Same as --tlspassword but used in HTTPS proxy context.

Added in 7.52.0.

--proxy-tlsuser

Same as --tlsuser but used in HTTPS proxy context.

Added in 7.52.0.

--proxy-tlsv1

Same as -1, --tlsv1 but used in HTTPS proxy context.

Added in 7.52.0.

-U, --proxy-user

Specify the user name and password to use for proxy authentication.

If you use a Windows SSPI-enabled curl binary and do either Negotiate or NTLM authentication then you can tell curl to select the user name and password from your environment by specifying a single colon with this option: "-U :".

On systems where it works, curl will hide the given option argument from process listings. This is not enough to protect credentials from possibly getting seen by other users on the same system as they will still be visible for a brief moment before cleared. Such sensitive data should be retrieved from a file instead or similar and never used in clear text in a command line.

If this option is used several times, the last one will be used.

-x, --proxy [protocol://]host[:port]

Use the specified proxy.

The proxy string can be specified with a protocol:// prefix. No protocol specified or http:// will be treated as HTTP proxy. Use socks4://, socks4a://, socks5:// or socks5h:// to request a specific SOCKS version to be used. (The protocol support was added in curl 7.21.7)

HTTPS proxy support via https:// protocol prefix was added in 7.52.0 for OpenSSL, GnuTLS and NSS.

Unrecognized and unsupported proxy protocols cause an error since 7.52.0. Prior versions may ignore the protocol and use http:// instead.

If the port number is not specified in the proxy string, it is assumed to be 1080.

This option overrides existing environment variables that set the proxy to use. If there's an environment variable setting a proxy, you can set proxy to "" to override it.

All operations that are performed over an HTTP proxy will transparently be converted to HTTP. It means that certain protocol specific operations might not be available. This is not the case if you can tunnel through the proxy, as one with the -p, --proxytunnel option.

User and password that might be provided in the proxy string are URL decoded by curl. This allows you to pass in special characters such as @ by using %40 or pass in a colon with %3a.

The proxy host can be specified the exact same way as the proxy environment variables, including the protocol prefix (http://) and the embedded user + password.

If this option is used several times, the last one will be used.

--proxy1.0

Use the specified HTTP 1.0 proxy. If the port number is not specified, it is assumed at port 1080.

The only difference between this and the HTTP proxy option -x, --proxy, is that attempts to use CONNECT through the proxy will specify an HTTP 1.0 protocol instead of the default HTTP 1.1.

-p, --proxytunnel

When an HTTP proxy is used -x, --proxy, this option will make curl tunnel through the proxy. The tunnel approach is made with the HTTP proxy CONNECT request and requires that the proxy allows direct connect to the remote port number curl wants to tunnel through to.

To suppress proxy CONNECT response headers when curl is set to output headers use --suppress-connect-headers.

See also -x, --proxy.

--pubkey

(SFTP SCP) Public key file name. Allows you to provide your public key in this separate file.

If this option is used several times, the last one will be used.

(As of 7.39.0, curl attempts to automatically extract the public key from the private key file, so passing this option is generally not required. Note that this public key extraction requires libcurl to be linked against a copy of libssh2 1.2.8 or higher that is itself linked against OpenSSL.)

-Q, --quote

(FTP SFTP) Send an arbitrary command to the remote FTP or SFTP server. Quote commands are sent BEFORE the transfer takes place (just after the initial PWD command in an FTP transfer, to be exact). To make commands take place after a successful transfer, prefix them with a dash '-'. To make commands be sent after curl has changed the working directory, just before the transfer command(s), prefix the command with a '+' (this is only supported for FTP). You may specify any number of commands.

If the server returns failure for one of the commands, the entire operation will be aborted. You must send syntactically correct FTP commands as RFC 959 defines to FTP servers, or one of the commands listed below to SFTP servers.

Prefix the command with an asterisk (*) to make curl continue even if the command fails as by default curl will stop at first failure.

This option can be used multiple times.

SFTP is a binary protocol. Unlike for FTP, curl interprets SFTP quote commands itself before sending them to the server. File names may be quoted shell-style to embed spaces or special characters. Following is the list of all supported SFTP quote commands:

chgrp group file

chgrp命令将由文件操作数命名的文件的组ID设置为由组操作数指定的组ID。组操作数是十进制整数组ID。

chmod模式文件

chmod命令修改指定文件的文件模式位。模式操作数是八进制整数模式编号。

chown用户文件

chown命令将文件操作数命名的文件的所有者设置为用户操作数指定的用户ID。用户操作数是十进制整数用户ID。

ln源文件目标文件

ln和symlink命令在target_file位置创建一个指向source_file位置的符号链接。

mkdir directory_name

mkdir命令创建由directory_name操作数命名的目录。

密码

pwd命令返回当前工作目录的绝对路径名。

重命名源目标

重命名命令将源操作数命名的文件或目录重命名为目标操作数命名的目标路径。

rm文件

rm命令除去由文件操作数指定的文件。

rmdir目录

rmdir命令删除由目录操作数指定的目录条目(如果为空)。

符号链接source_file target_file

参见ln。

--random-file <文件>

指定包含将被视为随机数据的文件的路径名。数据可用于为SSL连接的随机引擎提供种子。另请参见--egd-file选项。

-r,--range <范围>

(HTTP FTP SFTP FILE)从HTTP / 1.1,FTP或SFTP服务器或本地FILE检索字节范围(即部分文档)。范围可以通过多种方式指定。

0-499指定前500个字节

500-999 specifies the second 500 bytes

-500 specifies the last 500 bytes

9500- specifies the bytes from offset 9500 and forward

0-0,-1 specifies the first and last byte only(*)(HTTP)

100-199,500-599 specifies two separate 100-byte ranges(*) (HTTP)

(*) = NOTE that this will cause the server to reply with a multipart response!

Only digit characters (0-9) are valid in the 'start' and 'stop' fields of the 'start-stop' range syntax. If a non-digit character is given in the range, the server's response will be unspecified, depending on the server's configuration.

You should also be aware that many HTTP/1.1 servers do not have this feature enabled, so that when you attempt to get a range, you'll instead get the whole document.

FTP and SFTP range downloads only support the simple 'start-stop' syntax (optionally with one of the numbers omitted). FTP use depends on the extended FTP command SIZE.

If this option is used several times, the last one will be used.

--raw

(HTTP) When used, it disables all internal HTTP decoding of content or transfer encodings and instead makes them passed on unaltered, raw.

Added in 7.16.2.

-e, --referer

(HTTP) Sends the "Referrer Page" information to the HTTP server. This can also be set with the -H, --header flag of course. When used with -L, --location you can append ";auto" to the -e, --referer URL to make curl automatically set the previous URL when it follows a Location: header. The ";auto" string can be used alone, even if you don't set an initial -e, --referer.

If this option is used several times, the last one will be used.

See also -A, --user-agent and -H, --header.

-J, --remote-header-name

(HTTP) This option tells the -O, --remote-name option to use the server-specified Content-Disposition filename instead of extracting a filename from the URL.

If the server specifies a file name and a file with that name already exists in the current working directory it will not be overwritten and an error will occur. If the server doesn't specify a file name then this option has no effect.

There's no attempt to decode %-sequences (yet) in the provided file name, so this option may provide you with rather unexpected file names.

WARNING: Exercise judicious use of this option, especially on Windows. A rogue server could send you the name of a DLL or other file that could possibly be loaded automatically by Windows or some third party software.

--remote-name-all

This option changes the default action for all given URLs to be dealt with as if -O, --remote-name were used for each one. So if you want to disable that for a specific URL after --remote-name-all has been used, you must use "-o -" or --no-remote-name.

Added in 7.19.0.

-O, --remote-name

Write output to a local file named like the remote file we get. (Only the file part of the remote file is used, the path is cut off.)

The file will be saved in the current working directory. If you want the file saved in a different directory, make sure you change the current working directory before invoking curl with this option.

The remote file name to use for saving is extracted from the given URL, nothing else, and if it already exists it will be overwritten. If you want the server to be able to choose the file name refer to -J, --remote-header-name which can be used in addition to this option. If the server chooses a file name and that name already exists it will not be overwritten.

There is no URL decoding done on the file name. If it has %20 or other URL encoded parts of the name, they will end up as-is as file name.

You may use this option as many times as the number of URLs you have.

-R, --remote-time

When used, this will make curl attempt to figure out the timestamp of the remote file, and if that is available make the local file get that same timestamp.

--request-target

(HTTP) Tells curl to use an alternative "target" (path) instead of using the path as provided in the URL. Particularly useful when wanting to issue HTTP requests without leading slash or other data that doesn't follow the regular URL pattern, like "OPTIONS *".

Added in 7.55.0.

-X, --request

(HTTP) Specifies a custom request method to use when communicating with the HTTP server. The specified request method will be used instead of the method otherwise used (which defaults to GET). Read the HTTP 1.1 specification for details and explanations. Common additional HTTP requests include PUT and DELETE, but related technologies like WebDAV offers PROPFIND, COPY, MOVE and more.

Normally you don't need this option. All sorts of GET, HEAD, POST and PUT requests are rather invoked by using dedicated command line options.

This option only changes the actual word used in the HTTP request, it does not alter the way curl behaves. So for example if you want to make a proper HEAD request, using -X HEAD will not suffice. You need to use the -I, --head option.

The method string you set with -X, --request will be used for all requests, which if you for example use -L, --location may cause unintended side-effects when curl doesn't change request method according to the HTTP 30x response codes - and similar.

(FTP) Specifies a custom FTP command to use instead of LIST when doing file lists with FTP.

(POP3)指定要使用的自定义POP3命令,而不是LIST或RETR。(在7.26.0中添加)

(IMAP)指定要使用的自定义IMAP命令而不是LIST。(在7.30.0中添加)

(SMTP)指定要使用的自定义SMTP命令,而不是HELP或VRFY。(在7.34.0中添加)

如果多次使用此选项,则将使用最后一个。

--resolve <主机:端口:地址[,地址] …>

提供用于特定主机和端口对的自定义地址。使用此功能,您可以使卷曲请求使用指定的地址,并阻止使用原本可以正常解析的地址。考虑它是命令行上提供的/ etc / hosts替代方案。端口号应为主机将用于特定协议的号码。这意味着如果要提供同一主机但不同端口的地址,则需要几个条目。

通过指定“ *”作为主机,您可以告诉curl将任何主机和特定端口对解析为指定地址。最后解析通配符,因此将首先使用具有特定主机和端口的所有--resolve。

即使将-4,-ipv4或-6,-ipv6设置为使curl使用其他IP版本,也将使用此选项设置的提供的地址。

在7.57.0中添加了对在[括号]中提供IP地址的支持。

7.59.0中增加了对为每个条目提供多个IP地址的支持。

在7.64.0中添加了对通配符解析的支持。

此选项可以多次使用以添加许多要解析的主机名。

在7.21.3中添加。

--retry-connrefused

除了其他条件,对于--retry,也将ECONNREFUSED视为瞬态错误。该选项与--retry一起使用。

在7.52.0中添加。

--retry-delay <秒数>

在每次传输重试失败并出现短暂错误(每次重试之间会更改默认的退避时间算法)后,在每次重试之前让curl睡眠这段时间。仅当还使用--retry时,此选项才有意义。将此延迟设置为零将使curl使用默认的退避时间。

如果多次使用此选项,则将使用最后一个。

在7.12.3中添加。

--retry-max-time <秒>

重试计时器在第一次传输尝试之前被重置。只要计时器尚未达到此给定限制,重试将照常进行(请参阅--retry)。请注意,如果计时器未达到限制,则将发出请求,并且在执行过程中,该请求可能会花费比给定时间更长的时间。要限制单个请求的最大时间,请使用-m,-- max -time。将此选项设置为零以不使重试超时。

如果多次使用此选项,则将使用最后一个。

在7.12.3中添加。

--retry

如果curl尝试执行传输时返回了瞬时错误,它将在放弃之前重试此次数。将数字设置为0可使curl不重试(这是默认设置)。瞬态错误表示:超时,FTP 4xx响应代码或HTTP 408或5xx响应代码。

When curl is about to retry a transfer, it will first wait one second and then for all forthcoming retries it will double the waiting time until it reaches 10 minutes which then will be the delay between the rest of the retries. By using --retry-delay you disable this exponential backoff algorithm. See also --retry-max-time to limit the total time allowed for retries.

Since curl 7.66.0, curl will comply with the Retry-After: response header if one was present to know when to issue the next retry.

If this option is used several times, the last one will be used.

Added in 7.12.3.

--sasl-authzid

Use this authorisation identity (authzid), during SASL PLAIN authentication, in addition to the authentication identity (authcid) as specified by -u, --user.

If the option isn't specified, the server will derive the authzid from the authcid, but if specified, and depending on the server implementation, it may be used to access another user's inbox, that the user has been granted access to, or a shared mailbox for example.

Added in 7.66.0.

--sasl-ir

Enable initial response in SASL authentication.

Added in 7.31.0.

--service-name

This option allows you to change the service name for SPNEGO.

Examples: --negotiate --service-name sockd would use sockd/server-name.

Added in 7.43.0.

-S, --show-error

When used with -s, --silent, it makes curl show an error message if it fails.

-s, --silent

Silent or quiet mode. Don't show progress meter or error messages. Makes Curl mute. It will still output the data you ask for, potentially even to the terminal/stdout unless you redirect it.

Use -S, --show-error in addition to this option to disable progress meter but still show error messages.

See also -v, --verbose and --stderr.

--socks4

Use the specified SOCKS4 proxy. If the port number is not specified, it is assumed at port 1080.

This option overrides any previous use of -x, --proxy, as they are mutually exclusive.

Since 7.21.7, this option is superfluous since you can specify a socks4 proxy with -x, --proxy using a socks4:// protocol prefix.

Since 7.52.0, --preproxy can be used to specify a SOCKS proxy at the same time -x, --proxy is used with an HTTP/HTTPS proxy. In such a case curl first connects to the SOCKS proxy and then connects (through SOCKS) to the HTTP or HTTPS proxy.

If this option is used several times, the last one will be used.

Added in 7.15.2.

--socks4a

Use the specified SOCKS4a proxy. If the port number is not specified, it is assumed at port 1080.

This option overrides any previous use of -x, --proxy, as they are mutually exclusive.

Since 7.21.7, this option is superfluous since you can specify a socks4a proxy with -x, --proxy using a socks4a:// protocol prefix.

Since 7.52.0, --preproxy can be used to specify a SOCKS proxy at the same time -x, --proxy is used with an HTTP/HTTPS proxy. In such a case curl first connects to the SOCKS proxy and then connects (through SOCKS) to the HTTP or HTTPS proxy.

If this option is used several times, the last one will be used.

Added in 7.18.0.

--socks5-basic

Tells curl to use username/password authentication when connecting to a SOCKS5 proxy. The username/password authentication is enabled by default. Use --socks5-gssapi to force GSS-API authentication to SOCKS5 proxies.

Added in 7.55.0.

--socks5-gssapi-nec

As part of the GSS-API negotiation a protection mode is negotiated. RFC 1961 says in section 4.3/4.4 it should be protected, but the NEC reference implementation does not. The option --socks5-gssapi-nec allows the unprotected exchange of the protection mode negotiation.

Added in 7.19.4.

--socks5-gssapi-service

The default service name for a socks server is rcmd/server-fqdn. This option allows you to change it.

Examples: --socks5 proxy-name --socks5-gssapi-service sockd would use sockd/proxy-name --socks5 proxy-name --socks5-gssapi-service sockd/real-name would use sockd/real-name for cases where the proxy-name does not match the principal name.

Added in 7.19.4.

--socks5-gssapi

Tells curl to use GSS-API authentication when connecting to a SOCKS5 proxy. The GSS-API authentication is enabled by default (if curl is compiled with GSS-API support). Use --socks5-basic to force username/password authentication to SOCKS5 proxies.

Added in 7.55.0.

--socks5-hostname

Use the specified SOCKS5 proxy (and let the proxy resolve the host name). If the port number is not specified, it is assumed at port 1080.

This option overrides any previous use of -x, --proxy, as they are mutually exclusive.

Since 7.21.7, this option is superfluous since you can specify a socks5 hostname proxy with -x, --proxy using a socks5h:// protocol prefix.

Since 7.52.0, --preproxy can be used to specify a SOCKS proxy at the same time -x, --proxy is used with an HTTP/HTTPS proxy. In such a case curl first connects to the SOCKS proxy and then connects (through SOCKS) to the HTTP or HTTPS proxy.

If this option is used several times, the last one will be used.

Added in 7.18.0.

--socks5

Use the specified SOCKS5 proxy - but resolve the host name locally. If the port number is not specified, it is assumed at port 1080.

This option overrides any previous use of -x, --proxy, as they are mutually exclusive.

Since 7.21.7, this option is superfluous since you can specify a socks5 proxy with -x, --proxy using a socks5:// protocol prefix.

Since 7.52.0, --preproxy can be used to specify a SOCKS proxy at the same time -x, --proxy is used with an HTTP/HTTPS proxy. In such a case curl first connects to the SOCKS proxy and then connects (through SOCKS) to the HTTP or HTTPS proxy.

If this option is used several times, the last one will be used.

This option (as well as --socks4) does not work with IPV6, FTPS or LDAP.

Added in 7.18.0.

-Y, --speed-limit

If a download is slower than this given speed (in bytes per second) for speed-time seconds it gets aborted. speed-time is set with -y, --speed-time and is 30 if not set.

If this option is used several times, the last one will be used.

-y, --speed-time

If a download is slower than speed-limit bytes per second during a speed-time period, the download gets aborted. If speed-time is used, the default speed-limit will be 1 unless set with -Y, --speed-limit.

This option controls transfers and thus will not affect slow connects etc. If this is a concern for you, try the --connect-timeout option.

If this option is used several times, the last one will be used.

--ssl-allow-beast

This option tells curl to not work around a security flaw in the SSL3 and TLS1.0 protocols known as BEAST. If this option isn't used, the SSL layer may use workarounds known to cause interoperability problems with some older SSL implementations. WARNING: this option loosens the SSL security, and by using this flag you ask for exactly that.

Added in 7.25.0.

--ssl-no-revoke

(Schannel)此选项告诉curl禁用证书吊销检查。警告:此选项会松开SSL安全性,并且通过使用此标志,您可以确切地要求它。

在7.44.0中添加。

--ssl-reqd

(FTP IMAP POP3 SMTP)需要SSL / TLS进行连接。如果服务器不支持SSL / TLS,则终止连接。

此选项以前称为--ftp-ssl-reqd。

在7.20.0中添加。

--ssl

(FTP IMAP POP3 SMTP)尝试使用SSL / TLS进行连接。如果服务器不支持SSL / TLS,则恢复为非安全连接。另请参阅--ftp-ssl-control和--ssl-reqd,以了解所需的不同加密级别。

此选项以前称为--ftp-ssl(在7.11.0中添加)。该选项名称仍可以使用,但将在以后的版本中删除。

在7.20.0中添加。

-2,-sslv2

(SSL)与远程SSL服务器协商时,强制curl使用SSL版本2。有时,curl是在没有SSLv2支持的情况下构建的。SSLv2被广泛认为是不安全的(请参阅RFC 6176)。

另请参见--http1.1和--http2。-2,-sslv2要求基础libcurl构建为支持TLS。此选项将覆盖-3,-sslv3和-1,-tlsv1和--tlsv1.1和--tlsv1.2。

-3,-sslv3

(SSL)与远程SSL服务器协商时,强制curl使用SSL版本3。有时,curl是在没有SSLv3支持的情况下构建的。SSLv3被广泛认为是不安全的(请参阅RFC 7568)。

另请参见--http1.1和--http2。-3,-sslv3要求基础libcurl被构建为支持TLS。该选项将覆盖-2,-sslv2和-1,-tlsv1和--tlsv1.1和--tlsv1.2。

--stderr

而是将所有对stderr的写入重定向到指定文件。如果文件名是普通的“-”,则将其写入stdout。

如果多次使用此选项,则将使用最后一个。

另请参见-v,-verbose和-s,-silent。

--styled输出

将HTTP标头写入终端时,启用自动使用粗体字体样式。使用--no-styled-output将其关闭。

在7.61.0中添加。

--suppress-connect-headers

When -p, --proxytunnel is used and a CONNECT request is made don't output proxy CONNECT response headers. This option is meant to be used with -D, --dump-header or -i, --include which are used to show protocol headers in the output. It has no effect on debug options such as -v, --verbose or --trace, or any statistics.

See also -D, --dump-header and -i, --include and -p, --proxytunnel.

--tcp-fastopen

Enable use of TCP Fast Open (RFC7413).

Added in 7.49.0.

--tcp-nodelay

Turn on the TCP_NODELAY option. See the curl_easy_setopt(3) man page for details about this option.

Since 7.50.2, curl sets this option by default and you need to explicitly switch it off if you don't want it on.

Added in 7.11.2.

-t, --telnet-option

Pass options to the telnet protocol. Supported options are:

TTYPE= Sets the terminal type.

XDISPLOC= Sets the X display location.

NEW_ENV= Sets an environment variable.

--tftp-blksize

(TFTP) Set TFTP BLKSIZE option (must be >512). This is the block size that curl will try to use when transferring data to or from a TFTP server. By default 512 bytes will be used.

If this option is used several times, the last one will be used.

Added in 7.20.0.

--tftp-no-options

(TFTP) Tells curl not to send TFTP options requests.

This option improves interop with some legacy servers that do not acknowledge or properly implement TFTP options. When this option is used --tftp-blksize is ignored.

Added in 7.48.0.

-z, --time-cond

(HTTP FTP) Request a file that has been modified later than the given time and date, or one that has been modified before that time. The can be all sorts of date strings or if it doesn't match any internal ones, it is taken as a filename and tries to get the modification date (mtime) from instead. See the curl_getdate(3) man pages for date expression details.

Start the date expression with a dash (-) to make it request for a document that is older than the given date/time, default is a document that is newer than the specified date/time.

If this option is used several times, the last one will be used.

--tls-max

(SSL) VERSION defines maximum supported TLS version. The minimum acceptable version is set by tlsv1.0, tlsv1.1, tlsv1.2 or tlsv1.3.

default

Use up to recommended TLS version.

1.0

Use up to TLSv1.0.

1.1

Use up to TLSv1.1.

1.2

Use up to TLSv1.2.

1.3

Use up to TLSv1.3.

See also --tlsv1.0 and --tlsv1.1 and --tlsv1.2 and --tlsv1.3. --tls-max requires that the underlying libcurl was built to support TLS. Added in 7.54.0.

--tls13-ciphers

(TLS) Specifies which cipher suites to use in the connection if it negotiates TLS 1.3. The list of ciphers suites must specify valid ciphers. Read up on TLS 1.3 cipher suite details on this URL:

https://curl.haxx.se/docs/ssl-ciphers.html

This option is currently used only when curl is built to use OpenSSL 1.1.1 or later. If you are using a different SSL backend you can try setting TLS 1.3 cipher suites by using the --ciphers option.

If this option is used several times, the last one will be used.

--tlsauthtype

Set TLS authentication type. Currently, the only supported option is "SRP", for TLS-SRP (RFC 5054). If --tlsuser and --tlspassword are specified but --tlsauthtype is not, then this option defaults to "SRP". This option works only if the underlying libcurl is built with TLS-SRP support, which requires OpenSSL or GnuTLS with TLS-SRP support.

Added in 7.21.4.

--tlspassword

Set password for use with the TLS authentication method specified with --tlsauthtype. Requires that --tlsuser also be set.

This doesn't work with TLS 1.3.

Added in 7.21.4.

--tlsuser

Set username for use with the TLS authentication method specified with --tlsauthtype. Requires that --tlspassword also is set.

This doesn't work with TLS 1.3.

Added in 7.21.4.

--tlsv1.0

(TLS) Forces curl to use TLS version 1.0 or later when connecting to a remote TLS server.

In old versions of curl this option was documented to allow _only_ TLS 1.0, but behavior was inconsistent depending on the TLS library. Use --tls-max if you want to set a maximum TLS version.

Added in 7.34.0.

--tlsv1.1

(TLS) Forces curl to use TLS version 1.1 or later when connecting to a remote TLS server.

In old versions of curl this option was documented to allow _only_ TLS 1.1, but behavior was inconsistent depending on the TLS library. Use --tls-max if you want to set a maximum TLS version.

Added in 7.34.0.

--tlsv1.2

(TLS) Forces curl to use TLS version 1.2 or later when connecting to a remote TLS server.

In old versions of curl this option was documented to allow _only_ TLS 1.2, but behavior was inconsistent depending on the TLS library. Use --tls-max if you want to set a maximum TLS version.

Added in 7.34.0.

--tlsv1.3

(TLS) Forces curl to use TLS version 1.3 or later when connecting to a remote TLS server.

Note that TLS 1.3 is only supported by a subset of TLS backends. At the time of this writing, they are BoringSSL, NSS, and Secure Transport (on iOS 11 or later, and macOS 10.13 or later).

Added in 7.52.0.

-1, --tlsv1

(SSL) Tells curl to use at least TLS version 1.x when negotiating with a remote TLS server. That means TLS version 1.0 or higher

See also --http1.1 and --http2. -1, --tlsv1 requires that the underlying libcurl was built to support TLS. This option overrides --tlsv1.1 and --tlsv1.2 and --tlsv1.3.

--tr-encoding

(HTTP) Request a compressed Transfer-Encoding response using one of the algorithms curl supports, and uncompress the data while receiving it.

Added in 7.21.6.

--trace-ascii

Enables a full trace dump of all incoming and outgoing data, including descriptive information, to the given output file. Use "-" as filename to have the output sent to stdout.

This is very similar to --trace, but leaves out the hex part and only shows the ASCII part of the dump. It makes smaller output that might be easier to read for untrained humans.

If this option is used several times, the last one will be used.

This option overrides --trace and -v, --verbose.

--trace-time

Prepends a time stamp to each trace or verbose line that curl displays.

Added in 7.14.0.

--trace

Enables a full trace dump of all incoming and outgoing data, including descriptive information, to the given output file. Use "-" as filename to have the output sent to stdout. Use "%" as filename to have the output sent to stderr.

If this option is used several times, the last one will be used.

This option overrides -v, --verbose and --trace-ascii.

--unix-socket

(HTTP)通过此Unix域套接字连接,而不是使用网络。

在7.40.0中添加。

-T,--upload-file <文件>

这会将指定的本地文件传输到远程URL。如果指定的URL中没有文件部分,curl将附加本地文件名。注意,您必须在最后一个目录上使用结尾的/,才能真正向Curl证明没有文件名,或者curl会认为您的最后一个目录名是要使用的远程文件名。这很可能导致上传操作失败。如果在HTTP(S)服务器上使用此命令,则将使用PUT命令。

使用文件名“-”(一个破折号)来使用stdin而不是给定的文件。或者,文件名“。”。可以指定(单个句点)而不是“-”来在非阻塞模式下使用stdin,以允许在上传stdin时读取服务器输出。

您可以在命令行上为每个URL 指定一个-T,--upload-file。每个-T,--upload-file + URL对都指定要上传的内容以及上传到的位置。curl还支持-T --upload-file参数的“ globbing” ,这意味着您可以使用URL支持的相同URL globbing样式将多个文件上传到单个URL,如下所示:

curl --upload-file“ {file1,file2}” http://www.example.com

甚至

curl -T“ img [1-1000] .png” ftp://ftp.example.com/upload/

当上传到SMTP服务器时:假设上传的数据是RFC 5322格式的。它必须具有由用户正确格式化的必要的标题和邮件正文集,因为curl不会以任何方式对代码进行转码或进一步编码。

--url

指定要获取的URL。当您要在配置文件中指定URL时,此选项非常方便。

如果给定的URL缺少方案名称(例如“ http://”或“ ftp://”等),则curl将根据主机进行猜测。如果最外面的子域名与DICT,FTP,IMAP,LDAP,POP3或SMTP匹配,则将使用该协议,否则将使用HTTP。由于可以通过设置默认协议来禁用7.45.0猜测,因此有关详细信息,请参见--proto-default。

此选项可以使用多次。要控制此URL的写入位置,请使用-o,-- output或-O,--remote-name选项。

-B,--use-ascii

(FTP LDAP)启用ASCII传输。对于FTP,也可以通过使用以“; type = A”结尾的URL来强制实施。对于Win32系统,此选项使发送到stdout的数据处于文本模式。

-A,--user-agent <名称>

(HTTP)指定要发送到HTTP服务器的User-Agent字符串。要对字符串中的空格进行编码,请在字符串中用单引号引起来。也可以使用-H,-header或--proxy-header选项设置此标题。

如果多次使用此选项,则将使用最后一个。

-u,--user <用户名:密码>

指定用于服务器身份验证的用户名和密码。覆盖-n,--netrc和--netrc-optional。

如果仅指定用户名,curl会提示您输入密码。

用户名和密码在第一个冒号上分开,这使得使用此选项无法在用户名中使用冒号。密码仍然可以。

在可运行的系统上,curl将在进程列表中隐藏给定的option参数。这还不足以防止凭据在同一系统上被其他用户看到,因为它们在清除前的一会儿仍然可见。此类敏感数据应取而代之或类似的文件,并且切勿在命令行中以明文形式使用。

将Kerberos V5与基于Windows的服务器一起使用时,应在用户名中包括Windows域名,以便服务器成功获取Kerberos票证。如果您不这样做,则初始身份验证握手可能会失败。

使用NTLM时,例如,如果您的设置中只有一个域和林,则可以将用户名简单地指定为用户名,而不指定域。

要指定域名,请使用“下级登录名”或UPN(“用户主体名称”)格式。例如,分别为EXAMPLE \ user和user@example.com。

如果您使用支持Windows SSPI的curl二进制文件并执行Kerberos V5,Negotiate,NTLM或Digest身份验证,则可以通过使用以下选项指定单个冒号来告诉curl从您的环境中选择用户名和密码:“ -u:” 。

如果多次使用此选项,则将使用最后一个。

-v,--verbose

在操作过程中使卷曲变得冗长。对于调试和查看“引擎盖”下发生的事情很有用。以“>”开头的行表示curl发送的“标题数据”,以“ <”表示curl接收到的“标题数据”(在正常情况下是隐藏的),以“ *”开头的行表示curl提供的其他信息。

如果仅在输出中希望HTTP标头-i,则--include可能是您要查找的选项。

如果您认为此选项仍不能为您提供足够的详细信息,请考虑改用--trace或--trace-ascii。

使用-s,-silent可使卷发真正安静。

另请参见-i,--include。该选项将覆盖--trace和--trace-ascii。

-V,--version

显示有关curl和它使用的libcurl版本的信息。

第一行包含curl,libcurl的完整版本以及与可执行文件链接的其他第三方库。

第二行(以“ Protocols:”开头)显示了libcurl报告要支持的所有协议。

第三行(以“功能:”开头)显示了libcurl报告要提供的特定功能。可用功能包括:

IPv6

您可以与此一起使用IPv6。

krb4

支持FTP的Krb4。

SSL协议

支持各种协议的SSL版本,例如HTTPS,FTPS,POP3S等。

z

支持通过HTTP自动解压缩压缩文件。

NTLM

支持NTLM身份验证。

除错

该curl使用使用Debug构建的libcurl。这样可以进行更多的错误跟踪和内存调试等。仅适用于curl开发人员!

异步DNS

该curl使用异步名称解析。可以使用c-ares或线程化的解析器后端来完成异步名称解析。

斯内哥

支持SPNEGO身份验证。

大文件

此卷曲支持大文件(大于2GB)的传输。

国际化域名

该curl支持IDN-国际域名。

GSS API

支持GSS-API。

SPI

支持SSPI。

TLS-SRP

TLS支持SRP(安全远程密码)身份验证。

HTTP2

HTTP / 2支持已内置。

Unix套接字

提供了Unix套接字支持。

HTTPS代理

该curl是为支持HTTPS代理而构建的。

金属油墨

此curl支持Metalink(版本3和4(RFC 5854)),该版本描述了镜像和哈希。如果出现错误(例如文件或服务器不可用),curl将使用镜像进行故障转移。

PSL

PSL是Public Suffix List(公共后缀列表)的缩写,表示此卷曲是使用有关“公共后缀”的知识构建的。

多SSL

该curl支持多个TLS后端。

-w,--write-out <格式>

完成传输后,在stdout上使curl显示信息。格式是一个字符串,其中可能包含纯文本和任意数量的变量。可以将格式指定为文字“字符串”,也可以让curl从具有“ @filename”的文件中读取格式,并告诉curl从stdin中读取格式,您可以编写“ @-”。

如下所述,输出格式中存在的变量将由curl认为合适的值或文本替换。所有变量都指定为%{variable_name},并且要输出正常的%,您只需将它们写为%%。您可以使用\ n输出换行符,使用\ r输出回车符和使用\ t制表符空格。

输出将被写入标准输出,但是可以使用%{stderr}将其切换为标准错误。

注意:%符号是win32环境中的特殊符号,使用此选项时,%出现的所有%必须加倍。

可用的变量有:

content_type所请求文档的Content-Type(如果有)。

filename_effective curl写入的最终文件名。仅当告诉curl使用-O,--remote-name或-o,-- output选项写入文件时,这才有意义。与-J,--remote-header-name选项结合使用时,它最有用。(在7.26.0中添加)

ftp_entry_path登录到远程FTP服务器时,初始路径curl最终结束。(在7.15.4中添加)

http_code在上次检索的HTTP(S)或FTP(s)传输中找到的数字响应代码。在7.18.2中,添加了别名response_code以显示相同的信息。

http_connect在对curl CONNECT请求的最后一个响应(来自代理)中找到的数字代码。(在7.12.4中添加)

http_version有效使用的http版本。(在7.50.0中添加)

local_ip最近完成的连接的本地端的IP地址-可以是IPv4或IPv6(在7.29.0中添加)

local_port最近完成的连接的本地端口号(在7.29.0中添加)

num_connects最近传输中建立的新连接数。(在7.12.3中添加)

num_redirects请求中遵循的重定向数。(在7.12.3中添加)

proxy_ssl_verify_result请求的HTTPS代理的SSL对等证书验证的结果。0表示验证成功。(在7.52.0中添加)

redirect_url如果在没有-L,--location的情况下进行HTTP请求以跟随重定向(或满足--max-redir),则此变量将显示重定向将到达的实际URL 。(在7.18.2中添加)

remote_ip最近完成的连接的远程IP地址-可以是IPv4或IPv6(在7.29.0中添加)

remote_port最近完成的连接的远程端口号(在7.29.0中添加)

scheme有效使用的URL方案(有时称为协议)(在7.52.0中添加)

size_download已下载的字节总数。

size_header下载的标头的字节总数。

size_request HTTP请求中发送的字节总数。

size_upload已上传的字节总数。

speed_download卷曲为完整下载测得的平均下载速度。每秒字节数。

speed_upload为完整上传测量的平均卷曲上传速度。每秒字节数。

ssl_verify_result请求的SSL对等证书验证的结果。0表示验证成功。(在7.19.0中添加)

标准错误从那时起,这一点-w,--write出输出将被写入标准错误。(在7.63.0中添加)

stdout From this point on, the -w, --write-out output will be written to standard output. This is the default, but can be used to switch back after switching to stderr. (Added in 7.63.0)

time_appconnect The time, in seconds, it took from the start until the SSL/SSH/etc connect/handshake to the remote host was completed. (Added in 7.19.0)

time_connect The time, in seconds, it took from the start until the TCP connect to the remote host (or proxy) was completed.

time_namelookup The time, in seconds, it took from the start until the name resolving was completed.

time_pretransfer The time, in seconds, it took from the start until the file transfer was just about to begin. This includes all pre-transfer commands and negotiations that are specific to the particular protocol(s) involved.

time_redirect The time, in seconds, it took for all redirection steps including name lookup, connect, pretransfer and transfer before the final transaction was started. time_redirect shows the complete execution time for multiple redirections. (Added in 7.12.3)

time_starttransfer The time, in seconds, it took from the start until the first byte was just about to be transferred. This includes time_pretransfer and also the time the server needed to calculate the result.

time_total The total time, in seconds, that the full operation lasted.

url_effective The URL that was fetched last. This is most meaningful if you've told curl to follow location: headers.

If this option is used several times, the last one will be used.

--xattr

When saving output to a file, this option tells curl to store certain file metadata in extended file attributes. Currently, the URL is stored in the xdg.origin.url attribute and, for HTTP, the content type is stored in the mime_type attribute. If the file system does not support extended attributes, a warning is issued.

FILES
~/.curlrc

Default config file, see -K, --config for details.

ENVIRONMENT
The environment variables can be specified in lower case or upper case. The lower case version has precedence. http_proxy is an exception as it is only available in lower case.

Using an environment variable to set the proxy has the same effect as using the -x, --proxy option.

http_proxy [protocol://][:port]

Sets the proxy server to use for HTTP.

HTTPS_PROXY [protocol://][:port]

Sets the proxy server to use for HTTPS.

[url-protocol]_PROXY [protocol://][:port]

Sets the proxy server to use for [url-protocol], where the protocol is a protocol that curl supports and as specified in a URL. FTP, FTPS, POP3, IMAP, SMTP, LDAP etc.

ALL_PROXY [protocol://][:port]

Sets the proxy server to use if no protocol-specific proxy is set.

NO_PROXY

list of host names that shouldn't go through any proxy. If set to an asterisk '*' only, it matches all hosts. Each name in this list is matched as either a domain name which contains the hostname, or the hostname itself.

This environment variable disables use of the proxy even when specified with the -x, --proxy option. That is NO_PROXY=direct.example.com curl -x http://proxy.example.com http://direct.example.com accesses the target URL directly, and NO_PROXY=direct.example.com curl -x http://proxy.example.com http://somewhere.example.com accesses the target URL through the proxy.

The list of host names can also be include numerical IP addresses, and IPv6 versions should then be given without enclosing brackets.

PROXY PROTOCOL PREFIXES
Since curl version 7.21.7, the proxy string may be specified with a protocol:// prefix to specify alternative proxy protocols.

If no protocol is specified in the proxy string or if the string doesn't match a supported one, the proxy will be treated as an HTTP proxy.

The supported proxy protocol prefixes are as follows:

http://

Makes it use it as an HTTP proxy. The default if no scheme prefix is used.

https://

Makes it treated as an HTTPS proxy.

socks4://

Makes it the equivalent of --socks4

socks4a://

Makes it the equivalent of --socks4a

socks5://

Makes it the equivalent of --socks5

socks5h://

Makes it the equivalent of --socks5-hostname

EXIT CODES
There are a bunch of different error codes and their corresponding error messages that may appear during bad conditions. At the time of this writing, the exit codes are:

1

Unsupported protocol. This build of curl has no support for this protocol.

2

Failed to initialize.

3

URL malformed. The syntax was not correct.

4

A feature or option that was needed to perform the desired request was not enabled or was explicitly disabled at build-time. To make curl able to do this, you probably need another build of libcurl!

5

Couldn't resolve proxy. The given proxy host could not be resolved.

6

Couldn't resolve host. The given remote host was not resolved.

7

Failed to connect to host.

8

Weird server reply. The server sent data curl couldn't parse.

9

FTP access denied. The server denied login or denied access to the particular resource or directory you wanted to reach. Most often you tried to change to a directory that doesn't exist on the server.

10

FTP accept failed. While waiting for the server to connect back when an active FTP session is used, an error code was sent over the control connection or similar.

11

FTP weird PASS reply. Curl couldn't parse the reply sent to the PASS request.

12

During an active FTP session while waiting for the server to connect back to curl, the timeout expired.

13

FTP weird PASV reply, Curl couldn't parse the reply sent to the PASV request.

14

FTP weird 227 format. Curl couldn't parse the 227-line the server sent.

15

FTP can't get host. Couldn't resolve the host IP we got in the 227-line.

16

HTTP/2 error. A problem was detected in the HTTP2 framing layer. This is somewhat generic and can be one out of several problems, see the error message for details.

17

FTP couldn't set binary. Couldn't change transfer method to binary.

18

Partial file. Only a part of the file was transferred.

19

FTP couldn't download/access the given file, the RETR (or similar) command failed.

21

FTP quote error. A quote command returned error from the server.

22

HTTP page not retrieved. The requested url was not found or returned another error with the HTTP error code being 400 or above. This return code only appears if -f, --fail is used.

23

Write error. Curl couldn't write data to a local filesystem or similar.

25

FTP couldn't STOR file. The server denied the STOR operation, used for FTP uploading.

26

Read error. Various reading problems.

27

Out of memory. A memory allocation request failed.

28

Operation timeout. The specified time-out period was reached according to the conditions.

30

FTP PORT failed. The PORT command failed. Not all FTP servers support the PORT command, try doing a transfer using PASV instead!

31

FTP couldn't use REST. The REST command failed. This command is used for resumed FTP transfers.

33

HTTP range error. The range "command" didn't work.

34

HTTP post error. Internal post-request generation error.

35

SSL connect error. The SSL handshaking failed.

36

Bad download resume. Couldn't continue an earlier aborted download.

37

FILE couldn't read file. Failed to open the file. Permissions?

38

LDAP cannot bind. LDAP bind operation failed.

39

LDAP search failed.

41

Function not found. A required LDAP function was not found.

42

Aborted by callback. An application told curl to abort the operation.

43

Internal error. A function was called with a bad parameter.

45

Interface error. A specified outgoing interface could not be used.

47

Too many redirects. When following redirects, curl hit the maximum amount.

48

Unknown option specified to libcurl. This indicates that you passed a weird option to curl that was passed on to libcurl and rejected. Read up in the manual!

49

Malformed telnet option.

51

The peer's SSL certificate or SSH MD5 fingerprint was not OK.

52

The server didn't reply anything, which here is considered an error.

53

SSL crypto engine not found.

54

Cannot set SSL crypto engine as default.

55

Failed sending network data.

56

Failure in receiving network data.

58

Problem with the local certificate.

59

Couldn't use specified SSL cipher.

60

Peer certificate cannot be authenticated with known CA certificates.

61

Unrecognized transfer encoding.

62

Invalid LDAP URL.

63

Maximum file size exceeded.

64

Requested FTP SSL level failed.

65

Sending the data requires a rewind that failed.

66

Failed to initialise SSL Engine.

67

The user name, password, or similar was not accepted and curl failed to log in.

68

File not found on TFTP server.

69

Permission problem on TFTP server.

70

Out of disk space on TFTP server.

71

Illegal TFTP operation.

72

Unknown TFTP transfer ID.

73

File already exists (TFTP).

74

No such user (TFTP).

75

Character conversion failed.

76

Character conversion functions required.

77

Problem with reading the SSL CA cert (path? access rights?).

78

The resource referenced in the URL does not exist.

79

An unspecified error occurred during the SSH session.

80

Failed to shut down the SSL connection.

82

Could not load CRL file, missing or wrong format (added in 7.19.0).

83

Issuer check failed (added in 7.19.0).

84

The FTP PRET command failed

85

RTSP: mismatch of CSeq numbers

86

RTSP: mismatch of Session Identifiers

87

unable to parse FTP file list

88

FTP chunk callback reported error

89

No connection available, the session will be queued

90

SSL public key does not matched pinned public key

91

Invalid SSL certificate status.

92

Stream error in HTTP/2 framing layer.

XX

More error codes will appear here in future releases. The existing ones are meant to never change.

AUTHORS / CONTRIBUTORS
Daniel Stenberg is the main author, but the whole list of contributors is found in the separate THANKS file.

WWW
https://curl.haxx.se

SEE ALSO
ftp(1), wget(1)

该HTML页面是使用roffit制作的。