1.Volley 报错:
Volley: [218] BasicNetwork.performRequest: Unexpected response code 200 for http://www.weather.com.cn/data/cityinfo/101190101.html
2.查找资料认为,可能是请求头需要做一些修改
3.使用HttpClient进行访问连接没有问题,使用HttpURLConnection同样再现了1Volley报的错。
4.在HttpURLConnection中参照浏览器,添加一些请求头的参数看是否可返回数据。最后发现当添加了
headers.put("Accept-Encoding", "gzip, deflate, sdch");
时可以返回数据,但是为乱码
5.查找原因时,发现所填的请求头参数意思为:接收服务器端返回的压缩类型数据”gzip“等。
6.查找资料了解gzip为unix等系统常用压缩手段
HTTP 协议中 Vary 的一些研究
:https://imququ.com/post/vary-header-in-http.html
7.研究如何解压gzip文件