更新时间:2023-12-04 16:39:04
这里的问题是服务器配置不正确,因为它返回了响应gzip即使客户端未发送 Accept-Encoding:gzip
标头也是如此。
The problem here is a server that is probably not configured correctly, as it returns its response gzip compressed, even if the client does not send an Accept-Encoding: gzip
header.
所以,看到的是页面的压缩版本。要对其进行解压缩,请通过 GZIPInputStream :
So what you're seeing is the compressed version of the page. To decompress it, pass it through a GZIPInputStream:
BufferedReader in = new BufferedReader(
new InputStreamReader(
new GZIPInputStream(new URL("http://kickass.to/").openStream())));