You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Tim Ellison (JIRA)" <ji...@apache.org> on 2010/09/03 13:03:39 UTC
[jira] Updated: (HARMONY-6521) [classlib][luni]
HttpURLConnection.getResponseCode() hangs on incomplete chunked response
[ https://issues.apache.org/jira/browse/HARMONY-6521?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tim Ellison updated HARMONY-6521:
---------------------------------
Fix Version/s: (was: 5.0M15)
(was: 6.0M3)
> [classlib][luni] HttpURLConnection.getResponseCode() hangs on incomplete chunked response
> -----------------------------------------------------------------------------------------
>
> Key: HARMONY-6521
> URL: https://issues.apache.org/jira/browse/HARMONY-6521
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Affects Versions: 6.0M2, 5.0M14
> Reporter: Mark Hindess
>
> HttpURLConnection.getResponseCode() hangs when reading chunked responses because it eagerly tries to find the size of the first chunk. It should read the chunk size lazily. The RI doesn't hang.
> import java.io.OutputStream;
> import java.net.HttpURLConnection;
> import java.net.ServerSocket;
> import java.net.URL;
> public class HUCHang {
> public static void main(String[] args) throws Exception {
> ServerSocket server = new ServerSocket(0);
> URL u = new URL("http://"
> + server.getInetAddress().getHostAddress()
> + ":" + server.getLocalPort());
> HttpURLConnection uc = (HttpURLConnection)u.openConnection();
> uc.connect();
> OutputStream cos = server.accept().getOutputStream();
> String resp =
> "HTTP/1.1 200 OK\r\n"
> +"Content-Type: text/plain\r\n"
> +"Transfer-Encoding: chunked\r\n"
> +"\r\n"
> +"a"; // intentionally incomplete chunk size line
> cos.write(resp.getBytes());
> System.err.print("response code = \"");
> System.err.println(+ uc.getResponseCode() + "\"");
> }
> }
> Given that chunked responses are often used for (slow) streamed responses then matching behaviour makes sense.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.