HTTP响应抛出错误gzip:标头无效

HTTP响应抛出错误gzip:标头无效,http,go,response,Http,Go,Response,我不明白怎么了。对于其他URL,ioutil.ReadAll应该使用gzip 可以使用URL:romboutskrea.co.kr复制 错误: gzip:无效的标头 代码: 我明白了 检查主体内容:,它可能是一个HTTP响应,其中主体首先用gzip压缩,然后用分块传输编码编码 我们需要一份调查报告,因为。这个网站的回复是错误的。它声称是gzip编码,但实际上并没有压缩内容。响应如下所示: HTTP/1.1 200 OK ... Content-Encoding: gzip ... Transfe

我不明白怎么了。对于其他URL,ioutil.ReadAll应该使用gzip

可以使用URL:romboutskrea.co.kr复制

错误:

gzip:无效的标头

代码:

我明白了

检查主体内容:,它可能是一个HTTP响应,其中主体首先用gzip压缩,然后用分块传输编码编码


我们需要一份调查报告,因为。

这个网站的回复是错误的。它声称是gzip编码,但实际上并没有压缩内容。响应如下所示:

HTTP/1.1 200 OK
...
Content-Encoding: gzip
...
Transfer-Encoding: chunked
Content-Type: text/html; charset=euc-kr

8000
<html>
<head>
...
Python也是如此:

$ python3 -c 'import requests; requests.get("http://romboutskorea.co.kr/main/index.php?")'
...
requests.exceptions.ContentDecodingError: ('Received response with content-encoding: gzip, but failed to decode it.', error('Error -3 while decompressing data: incorrect header check'))

似乎工作正常,因此Go不请求压缩并忽略内容编码响应头。要全局禁用压缩,请执行以下操作:http.DefaultTransport.*http.Transport.DisableCompression=true。通常,通过网络进行通信时会出现错误,您应该优雅地处理错误,而不是调用log.Fatal。
HTTP/1.1 200 OK
...
Content-Encoding: gzip
...
Transfer-Encoding: chunked
Content-Type: text/html; charset=euc-kr

8000
<html>
<head>
...
$ curl -v --compressed http://romboutskorea.co.kr/main/index.php?
...
< HTTP/1.1 200 OK
< ...
< Content-Encoding: gzip
< ...
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=euc-kr
< 
* Error while processing content unencoding: invalid code lengths set
* Failed writing data
* Curl_http_done: called premature == 1
* Closing connection 0
curl: (23) Error while processing content unencoding: invalid code lengths set
$ python3 -c 'import requests; requests.get("http://romboutskorea.co.kr/main/index.php?")'
...
requests.exceptions.ContentDecodingError: ('Received response with content-encoding: gzip, but failed to decode it.', error('Error -3 while decompressing data: incorrect header check'))