hc-dev mailing list archives

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

     [ https://issues.apache.org/jira/browse/HTTPCORE-285?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Oleg Kalnichevski resolved HTTPCORE-285.
----------------------------------------

    Resolution: Invalid

Steve

One can use CoreConnectionPNames#MAX_LINE_LENGTH and CoreConnectionPNames#MAX_HEADER_COUNT
parameters in order to set a limit on allowed line length and number of lines in an HTTP message
and avoid DoS type of conditions. 

http://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/impl/io/AbstractMessageParser.html

Oleg
                
> 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