> Important note: The post occurs to a different server than the > download so the servers themselves should not be causing the problem.
On Wed, Jan 27, 2010 at 6:50 PM, Kevin Duffey <andjar...@gmail.com> wrote: > Is it possible the server you are reaching for is single threaded in some > way that it rejects more than one request from the same client? > > > On Wed, Jan 27, 2010 at 3:09 PM, Biosopher <biosop...@gmail.com> wrote: > >> I have an app making an https post on one thread while performing a >> file download on another thread. For some odd reason, I am getting a >> ClientProtocolException saying that "The server failed to respond with >> a valid HTTP response". The error goes away if everything is run on a >> separate thread. >> >> Oddly if I run the two server requests in serial, the error goes >> away. It seems there's a bug that happens when two requests are made >> at the same time. >> >> Important note: The post occurs to a different server than the >> download so the servers themselves should not be causing the problem. >> >> The code is simple. Here's the file download code: >> >> HttpGet httpGet = new HttpGet(url); >> HttpClient client = new DefaultHttpClient(); >> HttpParams params = client.getParams(); >> HttpConnectionParams.setConnectionTimeout(params, 15000); >> HttpResponse httpResponse = client.execute(httpGet); >> HttpEntity responseEntity = httpResponse.getEntity(); >> byte[] data = EntityUtils.toByteArray(responseEntity); >> >> The post code's the same except for these additional lines: >> >> HttpPut httpPut = new HttpPut(url); >> httpPut.addHeader("Content-Type", "text/xml"); >> httpPut.setEntity(new StringEntity(postData, "UTF-8")); >> BasicHttpParams parameters = new BasicHttpParams(); >> HttpConnectionParams.setConnectionTimeout(parameters, 15000); >> HttpClient client = new DefaultHttpClient(); >> HttpResponse httpResponse = client.execute(httpPut); >> HttpEntity responseEntity = httpResponse.getEntity(); >> metaData = EntityUtils.toString(responseEntity); >> >> Thanks, >> Anthony >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to android-developers@googlegroups.com >> To unsubscribe from this group, send email to >> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en > > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en