我有一个HTTP Post请求,它应该返回大约80k的数据。我的服务器在EC2上,当我从EC2实例运行curl请求时,工作正常。
curl --data '<request data>' <my server address>
然而,当我在家里使用我的机器时,我得到以下内容:
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed
100 36128 0 35880 100 248 20775 143 0:00:01 0:00:01 --:--:-- 20775
curl: (18) transfer closed with outstanding read data remaining
我遇到类似的问题,当我使用以下代码时,只读取大约37KB:
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("Content-type", "application/json");
StringEntity entity = new StringEntity(params.toString());
httpPost.setEntity(entity);
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(
is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
is.close();
json = sb.toString();
Log.d("MyServer", "json len: " + json.length());
知道我做错了什么吗?当我使用EC2机器发送请求时,我感到非常困惑的事实是卷曲效果很好。这是某种超时问题吗?
答案 0 :(得分:0)
问题原来是我的nginx
设置。我没有指定proxy_temp_path
,并且由于请求很大,因此存储要转发的请求时出现问题。
http://wiki.nginx.org/HttpProxyModule#proxy_temp_path