Prevent OOM on HTTP requests
@@ -660,6 +660,14 @@ public abstract class ONetworkProtocolHttpAbstract extends ONetworkProtocol {
return;
}
requestContent.append(c);
+ //review this number: NETWORK_HTTP_MAX_CONTENT_LENGTH should refer to the body only...
+ if (OGlobalConfiguration.NETWORK_HTTP_MAX_CONTENT_LENGTH.getValueAsInteger() > -1
+ && requestContent.length() >= 10000 + OGlobalConfiguration.NETWORK_HTTP_MAX_CONTENT_LENGTH.getValueAsInteger() * 2) {
+ while (channel.inStream.available() > 0) {
+ channel.read();
+ }
+ throw new ONetworkProtocolException("Invalid http request, max content length exceeded");
+ }
}
if (OLogManager.instance().isDebugEnabled())
