curl: (6) Could not resolve host: application

举报
DevFeng 发表于 2021/09/10 11:51:49 2021/09/10
【摘要】 官方文档 curl -X PUT -H 'Content-Type: application/x-www-form-urlencoded' -H 'Authorization: Bearer WMte3bGuOukEeiTkNP4grL7iwAAAAAAAAAAAAAAAAAAAAGL4CTw6XgR6LaXXVmNX4QCAgMAAAFnKdc-ZgBPGgBFTrLhhyK8woMEI0...

官方文档 

curl -X PUT -H 'Content-Type: application/x-www-form-urlencoded' -H 'Authorization: Bearer WMte3bGuOukEeiTkNP4grL7iwAAAAAAAAAAAAAAAAAAAAGL4CTw6XgR6LaXXVmNX4QCAgMAAAFnKdc-ZgBPGgBFTrLhhyK8woMEI005emtrLJFJV6aoxsZSioSIZkr5kw12' -d 'avatar=http://www.easemob.com/avatar.png&ext=ext&nickname=nickname' 'http://a1.easemob.com/easemob-demo/testapp/metadata/user/user1'

复制后运行, curl: (6) Could not resolve host: application


curl官方网站查看:https://curl.se/docs/manpage.html

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

6

无法解析主机地址

无法解析主机。无法解析给定的远程主机。

官方错误码

错误码如下

EXIT CODES

There are a bunch of different error codes and their corresponding error messages that may appear under error 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 could not be 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 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

Mismatch of RTSP CSeq numbers.

86

Mismatch of RTSP 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.

93

An API function was called from inside a callback.

94

An authentication function returned an error.

95

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

96

QUIC connection error. This error may be caused by an SSL library error. QUIC is the protocol used for HTTP/3 transfers.

XX

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

CURL状态码列表

状态码

状态原因

解释

0

正常访问

 

1

错误的协议

未支持的协议。此版cURL 不支持这一协议。

2

初始化代码失败

初始化失败。

3

URL格式不正确

URL 格式错误。语法不正确。

4

请求协议错误

 

5

无法解析代理

无法解析代理。无法解析给定代理主机。

6

无法解析主机地址

无法解析主机。无法解析给定的远程主机。

7

无法连接到主机

无法连接到主机。

8

远程服务器不可用

FTP 非正常的服务器应答。cURL 无法解析服务器发送的数据。

9

访问资源错误

FTP 访问被拒绝。服务器拒绝登入或无法获取您想要的特定资源或目录。最有可
能的是您试图进入一个在此服务器上不存在的目录。

11

FTP密码错误

FTP 非正常的PASS 回复。cURL 无法解析发送到PASS 请求的应答。

13

结果错误

FTP 非正常的的PASV 应答,cURL 无法解析发送到PASV 请求的应答。

14

FTP回应PASV命令

FTP 非正常的227格式。cURL 无法解析服务器发送的227行。

15

内部故障

FTP 无法连接到主机。无法解析在227行中获取的主机IP。

17

设置传输模式为二进制

FTP 无法设定为二进制传输。无法改变传输方式到二进制。

18

文件传输短或大于预期

部分文件。只有部分文件被传输。

19

RETR命令传输完成

FTP 不能下载/访问给定的文件, RETR (或类似)命令失败。

21

命令成功完成

FTP quote 错误。quote 命令从服务器返回错误。

22

返回正常

HTTP 找不到网页。找不到所请求的URL 或返回另一个HTTP 400或以上错误。
此返回代码只出现在使用了-f/--fail 选项以后。

23

数据写入失败

写入错误。cURL 无法向本地文件系统或类似目的写入数据。

25

无法启动上传

FTP 无法STOR 文件。服务器拒绝了用于FTP 上传的STOR 操作。

26

回调错误

读错误。各类读取问题。

27

内存分配请求失败

内存不足。内存分配请求失败。

28

访问超时

操作超时。到达指定的超时期限条件。

30

FTP端口错误

FTP PORT 失败。PORT 命令失败。并非所有的FTP 服务器支持PORT 命令,请
尝试使用被动(PASV)传输代替!

31

FTP错误

FTP 无法使用REST 命令。REST 命令失败。此命令用来恢复的FTP 传输。

33

不支持请求

HTTP range 错误。range "命令"不起作用。

34

内部发生错误

HTTP POST 错误。内部POST 请求产生错误。

35

SSL/TLS握手失败

SSL 连接错误。SSL 握手失败。

36

下载无法恢复

FTP 续传损坏。不能继续早些时候被中止的下载。

37

文件权限错误

文件无法读取。无法打开文件。权限问题?

38

LDAP可没有约束力

LDAP 无法绑定。LDAP 绑定(bind)操作失败。

39

LDAP搜索失败

LDAP 搜索失败。

41

函数没有找到

功能无法找到。无法找到必要的LDAP 功能。

42

中止的回调

由回调终止。应用程序告知cURL 终止运作。

43

内部错误

内部错误。由一个不正确参数调用了功能。

45

接口错误

接口错误。指定的外发接口无法使用。

47

过多的重定向

过多的重定向。cURL 达到了跟随重定向设定的最大限额跟

48

无法识别选项

指定了未知TELNET 选项。

49

TELNET格式错误

不合式的telnet 选项。

51

远程服务器的SSL证书

peer 的SSL 证书或SSH 的MD5指纹没有确定。

52

服务器无返回内容

服务器无任何应答,该情况在此处被认为是一个错误。

53

加密引擎未找到

找不到SSL 加密引擎。

54

设定默认SSL加密失败

无法将SSL 加密引擎设置为默认。

55

无法发送网络数据

发送网络数据失败。

56

衰竭接收网络数据

在接收网络数据时失败。

57

   

58

本地客户端证书

本地证书有问题。

59

无法使用密码

无法使用指定的SSL 密码。

60

凭证无法验证

peer 证书无法被已知的CA 证书验证。

61

无法识别的传输编码

无法辨识的传输编码。

62

无效的LDAP URL

无效的LDAP URL。

63

文件超过最大大小

超过最大文件尺寸。

64

FTP失败

要求的FTP 的SSL 水平失败。

65

倒带操作失败

发送此数据需要的回卷(rewind)失败。

66

SSL引擎失败

初始化SSL 引擎失败。

67

服务器拒绝登录

用户名、密码或类似的信息未被接受,cURL 登录失败。

68

未找到文件

在TFTP 服务器上找不到文件。

69

无权限

TFTP 服务器权限有问题。

70

超出服务器磁盘空间

TFTP 服务器磁盘空间不足。

71

非法TFTP操作

非法的TFTP 操作。

72

未知TFTP传输的ID

未知TFTP 传输编号(ID)。

73

文件已经存在

文件已存在(TFTP) 。

74

错误TFTP服务器

无此用户(TFTP) 。

75

字符转换失败

字符转换失败。

76

必须记录回调

需要字符转换功能。

77

CA证书权限

读SSL 证书出现问题(路径?访问权限? ) 。

78

URL中引用资源不存在

URL 中引用的资源不存在。

79

错误发生在SSH会话

SSH 会话期间发生一个未知错误。

80

无法关闭SSL连接

未能关闭SSL 连接。

81

服务未准备

 

82

无法载入CRL文件

无法加载CRL 文件,丢失或格式不正确(在7.19.0版中增加) 。

83

发行人检查失败

签发检查失败(在7.19.0版中增加) 。

84

FTP PRET命令失败

 

85

RTSP:CSeq编号不匹配

 

86

RTSP:会话标识符不匹配

 

87

无法解析FTP文件列表

 

88

FTP块回调报告错误

 

89

没有可用的连接,会话将排队

 

90

SSL公钥与固定公钥不匹配

 

91

SSL证书状态无效

 

92

HTTP / 2框架层中的流错误

 

XX

其他

更多错误代码将在以后的版本中显示。现有的那些永远都不会改变。

找到了原因,那为什么会出现这个错误,我复制的是官方文档,理论不应该出现这个错误,难道是官方文档写错了。

官方文档是当引号,我使用了windows环境。命令内容应该不会有问题,会不会是单引号的问题?

百度一下,cmd单引号和双引号

找了这篇文章:
cmd - Windows批处理文件中的单引号有什么作用?

我最近在Windows cmd中运行了一个带有单引号的命令,发现它的行为不符合我的预期。

从尝试使用Google“ Windows批处理单引号与双引号”开始,我发现了几篇文章,人们在其中询问有关Windows将双引号视为双引号,以及bash如何区别对待单引号和双引号的问题。但是,我无法轻易找到Windows批处理命令中单引号的确切解释。

那么Windows批处理文件中的单引号是什么呢?他们是否执行任何形式的报价功能?


答复:
cmd.exe命令处理器根本不使用单引号,除非将命令括在FOR / F语句中运行:
for /f %%A in ('someCommand') do ...
或者,如果使用USEBACKQ选项,则指定要由FOR / F处理的字符串:

for /f "usebackq" %%A in ('some string') do ...
cmd.exe处理的所有其他引用都用双引号引起来。但是,有些Windows实用程序(外部命令)(例如WMIC)将单引号用于自己的引用目的。但是没有标准-每个实用程序都可以自由解释单引号。

cmd.exe与各种命令行实用程序使用的不一致的转义和引用规则经常使查找任何给定情况所需的正确语法变得困难。

这是有关"对cmd.exe使用双引号的一些重要说明。

双引号是一个简单的状态机。第一个"引用打开,第二个引用关闭。

用引号引起来的所有特殊字符都被当作文字值,但总是%和<newLine>字符除外;!如果启用了延迟扩展,则该^字符;如果启用了延迟扩展,则该字符!也出现在行中。

如果引用已关闭,则可以转义一个"as^"以防止其打开引用。但是一旦报价成功,您就无法逃脱闭幕式"。下一个"将始终关闭引用。

然后把命令中的单引号改成双引号执行

执行成功

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。