Macos 为什么html2text生成HTTP/1.0 400错误请求?
在OS X上,我通过自制程序安装了Macos 为什么html2text生成HTTP/1.0 400错误请求?,macos,command-line,syntax,httpresponse,http-status-code-400,Macos,Command Line,Syntax,Httpresponse,Http Status Code 400,在OS X上,我通过自制程序安装了html2text,但在运行时出现以下错误: $ html2text http://www.example.com/ HTTP/1.0 400错误请求内容类型:文本/html内容长度:349 连接:关闭日期:2016年4月13日星期三17:21:22 GMT服务器:ECSF(iad/18CC) `******400-请求错误****** 尽管此语法有效: curl http://www.example.com/ | html2text 当使用curl时,它
html2text
,但在运行时出现以下错误:
$ html2text http://www.example.com/
HTTP/1.0 400错误请求内容类型:文本/html内容长度:349
连接:关闭日期:2016年4月13日星期三17:21:22 GMT服务器:ECSF(iad/18CC)
`******400-请求错误******
尽管此语法有效:
curl http://www.example.com/ | html2text
当使用curl
时,它也可以工作(返回纯html),所以我不确定直接调用URL时XML代码在做什么
这里发生了什么事?或者如何使用直接提供URL的html2text
命令强制获取HTML
这是html2text,版本1.3.2a 以下是其他信息:
$ html2text -check http://www.example.com/
<HTML xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<HEAD>
<TITLE>
400 - Bad Request
</TITLE>
</HEAD>
<BODY>
<P>
HTTP/1.0 400 Bad Request Content-Type: text/html Content-Length: 349 Connection: close Date: Wed, 13 Apr 2016 17:48:20 GMT Server: ECSF (iad/18CD) <?xml version="1.0" encoding="iso-8859-1"?>
</P>
<H1>
400 - Bad Request
</H1>
</BODY>
</HTML>
$ curl -I http://www.example.com/
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: max-age=604800
Content-Type: text/html
Date: Wed, 13 Apr 2016 17:57:56 GMT
Etag: "359670651+gzip"
Expires: Wed, 20 Apr 2016 17:57:56 GMT
Last-Modified: Fri, 09 Aug 2013 23:54:35 GMT
Server: ECS (iad/182A)
X-Cache: HIT
x-ec-custom-error: 1
Content-Length: 1270
$ curl -0 http://www.example.com/
<!doctype html>
<html>
<head>
...
</head>
<body>
<div>
<h1>Example Domain</h1>
...
</div>
</body>
</html>
$html2text-检查http://www.example.com/
400-请求错误
HTTP/1.0 400错误请求内容类型:文本/html内容长度:349连接:关闭日期:2016年4月13日星期三17:48:20 GMT服务器:ECSF(iad/18CD)?xml version=“1.0”encoding=“iso-8859-1”?
400-请求错误
$curl-Ihttp://www.example.com/
HTTP/1.1200ok
接受范围:字节
缓存控制:最大年龄=604800
内容类型:text/html
日期:2016年4月13日星期三17:57:56 GMT
Etag:“359670651+gzip”
到期时间:2016年4月20日星期三17:57:56 GMT
最后修改:2013年8月9日星期五23:54:35 GMT
服务器:ECS(iad/182A)
X缓存:命中
x-ec-custom-error:1
内容长度:1270
$curl-0http://www.example.com/
...
示例域
...
您能用附加信息更新您的问题吗?html2text-version
的输出以及html2text-checkhttp://www.example.com/
,谢谢你,还有:curl-Ihttp://www.example.com/
,这是一个I,就像在印度一样。谢谢,谢谢。现在,为了排除协议问题,让curl发送http 1.0,您可以使用以下内容进行更新:curl-0http://www.example.com/
,thanks@user454038更新。