remm 2004/01/22 10:26:53 Modified: http11/src/java/org/apache/coyote/http11 Http11Processor.java Http11Protocol.java Log: - Allow configuring the header size (for most use cases, it was too big, and since it represents 75% of the memory allocated by Tomcat). - New default size: 4 KB (the whole HTTP header must fit inside that, for both the request and the response). - Allocations of these buffers can't be dynamic: there are too many references lying around, and this guarantees leaks. The only safe way to reallocate the buffers if to get rid of the processor. - Note: In Tomcat 4.1.30, I'll integrate the same connectors as in 5.0.18, to avoid possible problems. Revision Changes Path 1.95 +7 -2 jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java Index: Http11Processor.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v retrieving revision 1.94 retrieving revision 1.95 diff -u -r1.94 -r1.95 --- Http11Processor.java 14 Jan 2004 11:12:50 -0000 1.94 +++ Http11Processor.java 22 Jan 2004 18:26:52 -0000 1.95 @@ -119,14 +119,19 @@ * Default constructor. */ public Http11Processor() { + this(Constants.DEFAULT_HTTP_HEADER_BUFFER_SIZE); + } + + + public Http11Processor(int headerBufferSize) { request = new Request(); - inputBuffer = new InternalInputBuffer(request); + inputBuffer = new InternalInputBuffer(request, headerBufferSize); request.setInputBuffer(inputBuffer); response = new Response(); response.setHook(this); - outputBuffer = new InternalOutputBuffer(response); + outputBuffer = new InternalOutputBuffer(response, headerBufferSize); response.setOutputBuffer(outputBuffer); request.setResponse(response); 1.47 +12 -1 jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java Index: Http11Protocol.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- Http11Protocol.java 15 Jan 2004 13:16:41 -0000 1.46 +++ Http11Protocol.java 22 Jan 2004 18:26:52 -0000 1.47 @@ -246,6 +246,7 @@ private int maxKeepAliveRequests=100; // as in Apache HTTPD server private int timeout = 300000; // 5 minutes as in Apache HTTPD server private int maxPostSize = 2 * 1024 * 1024; + private int maxHttpHeaderSize = 4 * 1024; private String reportedname; private int socketCloseDelay=-1; private boolean disableUploadTimeout = true; @@ -397,6 +398,15 @@ setAttribute("maxPostSize", "" + valueI); } + public int getMaxHttpHeaderSize() { + return maxHttpHeaderSize; + } + + public void setMaxHttpHeaderSize(int valueI) { + maxHttpHeaderSize = valueI; + setAttribute("maxHttpHeaderSize", "" + valueI); + } + public String getRestrictedUserAgents() { return restrictedUserAgents; } @@ -639,7 +649,8 @@ public Object[] init() { Object thData[]=new Object[3]; - Http11Processor processor = new Http11Processor(); + Http11Processor processor = + new Http11Processor(proto.maxHttpHeaderSize); processor.setAdapter( proto.adapter ); processor.setThreadPool( proto.tp ); processor.setMaxKeepAliveRequests( proto.maxKeepAliveRequests );
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]