hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Jones (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HTTPCORE-285) Handle invalid HTTP traffic
Date Sun, 04 Dec 2011 01:04:39 GMT
Handle invalid HTTP traffic
---------------------------

                 Key: HTTPCORE-285
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-285
             Project: HttpComponents HttpCore
          Issue Type: Bug
          Components: HttpCore
    Affects Versions: 4.1.2
            Reporter: Steve Jones


Invalid HTTP responses are not handled well and can cause OutOfMemoryError errors.

Most errors can probably be addressed by limiting the length when reading a line. 

For example:

    cat /dev/zero | nc -l 1234    # run a server that spews invalid data
    java org.apache.http.examples.client.ClientWithResponseHandler # modified example to connect
to above server

Result:

    executing request http://localhost:1234/
    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at org.apache.http.util.ByteArrayBuffer.expand(ByteArrayBuffer.java:59)
	at org.apache.http.util.ByteArrayBuffer.append(ByteArrayBuffer.java:89)
	at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:261)
	at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:98)
	at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:252)
	at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:281)
	at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:247)
	at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:219)
	at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:298)
	at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
	at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:645)
	at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:464)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:941)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:919)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:910)
	at org.apache.http.examples.client.ClientWithResponseHandler.main(ClientWithResponseHandler.java:52)


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message