HttpUrlConnection behaving different in Android 2.3 Gingerbread
<p>I'm stumped here.  I've been using the same HttpUrlConnection code to retrieve JSON from my server since Android 1.5.  Suddenly, with 2.3 it won't work and I can't understand why.</p>

<p>Here's my code:</p>

<pre><code>        try {            
        HttpURLConnection conn = 
            (HttpURLConnection)(new URL(Constants.SERVER_URL + path)).openConnection();
        conn.setAllowUserInteraction(false); // no user interact [like pop up]
        conn.setDoOutput(true); // want to send
        conn.setDoInput(true);
        conn.setRequestMethod( "POST" );

        conn.setRequestProperty( "Content-type", "application/x-www-form-urlencoded" );
        conn.setRequestProperty( "Accept", "application/json,text/html,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" );
        conn.setRequestProperty( "Accept-Charset", "UTF-8" );
        conn.setRequestProperty("Connection", "Keep-Alive");


        DataOutputStream pw = new DataOutputStream (conn.getOutputStream());
        pw.writeBytes(requestString);
        pw.flush();
        pw.close(); 



        if (conn.getResponseCode() == 200) {
            InputStream in = new BufferedInputStream(conn.getInputStream());
            BufferedReader br = new  BufferedReader(new InputStreamReader(in));

            StringBuffer stringBuffer = new StringBuffer();

            while(br.ready()){
                stringBuffer.append(br.readLine());
            }

            br.close();
            in.close();

            return stringBuffer.toString();

        } else {
            return badResponse;
        }

    } catch (Exception ioe) {
        return ERROR_MAKING_CONNECTION;
    }
</code></pre>

<p>The response comes back with a code of 200, however, when I run conn.getInputStream().available() the result is -1.  On every other android api besides 2.3 the conn.getInputStream().available() returns a significant response.</p>

<p>Any ideas?</p>
