hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r547044 - in /jakarta/httpcomponents/httpcore/trunk: module-main/src/main/java/org/apache/http/impl/ module-main/src/main/java/org/apache/http/impl/io/ module-main/src/main/java/org/apache/http/io/ module-main/src/test/java/org/apache/http/...
Date Wed, 13 Jun 2007 22:07:59 GMT
Author: olegk
Date: Wed Jun 13 15:07:46 2007
New Revision: 547044

URL: http://svn.apache.org/viewvc?view=rev&rev=547044
Log:
Renamed #reset() method to #configure() in HttpDataReceiver and HttpDataTransmitter interfaces;
Added #configure() method to the HttpRequestMessage class

Modified:
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataReceiver.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataTransmitter.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataReceiver.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataTransmitter.java
    jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/TestHttpDataReceiverAndTransmitter.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpMessageParser.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpRequestParser.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpResponseParser.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/test/java/org/apache/http/impl/nio/codecs/TestHttpMessageParser.java

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java?view=diff&rev=547044&r1=547043&r2=547044
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java
Wed Jun 13 15:07:46 2007
@@ -110,7 +110,7 @@
             final HttpParams params) throws IOException {
         int buffersize = HttpConnectionParams.getSocketBufferSize(params);
         HttpDataTransmitter transmitter = new SocketHttpDataTransmitter(this.socket, buffersize);
-        transmitter.reset(params);
+        transmitter.configure(params);
         return transmitter;
     }
     
@@ -118,7 +118,7 @@
             final HttpParams params) throws IOException {
         int buffersize = HttpConnectionParams.getSocketBufferSize(params);
         HttpDataReceiver receiver =  new SocketHttpDataReceiver(this.socket, buffersize);
-        receiver.reset(params);
+        receiver.configure(params);
         return receiver;
     }
     

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java?view=diff&rev=547044&r1=547043&r2=547044
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java
Wed Jun 13 15:07:46 2007
@@ -96,8 +96,8 @@
         int buffersize = HttpConnectionParams.getSocketBufferSize(params);
         HttpDataTransmitter transmitter = new SocketHttpDataTransmitter(socket, buffersize);
         HttpDataReceiver receiver = new SocketHttpDataReceiver(socket, buffersize);
-        transmitter.reset(params);
-        receiver.reset(params);
+        transmitter.configure(params);
+        receiver.configure(params);
         
         setHttpDataReceiver(receiver);
         setHttpDataTransmitter(transmitter);

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataReceiver.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataReceiver.java?view=diff&rev=547044&r1=547043&r2=547044
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataReceiver.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataReceiver.java
Wed Jun 13 15:07:46 2007
@@ -256,7 +256,7 @@
         }
     }
     
-    public void reset(final HttpParams params) {
+    public void configure(final HttpParams params) {
         this.charset = HttpProtocolParams.getHttpElementCharset(params);
         this.ascii = this.charset.equalsIgnoreCase(HTTP.US_ASCII)
                      || this.charset.equalsIgnoreCase(HTTP.ASCII);

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataTransmitter.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataTransmitter.java?view=diff&rev=547044&r1=547043&r2=547044
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataTransmitter.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/AbstractHttpDataTransmitter.java
Wed Jun 13 15:07:46 2007
@@ -165,7 +165,7 @@
         write(CRLF);
     }
     
-    public void reset(final HttpParams params) {
+    public void configure(final HttpParams params) {
         this.charset = HttpProtocolParams.getHttpElementCharset(params); 
         this.ascii = this.charset.equalsIgnoreCase(HTTP.US_ASCII)
                      || this.charset.equalsIgnoreCase(HTTP.ASCII);

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataReceiver.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataReceiver.java?view=diff&rev=547044&r1=547043&r2=547044
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataReceiver.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataReceiver.java
Wed Jun 13 15:07:46 2007
@@ -49,7 +49,7 @@
  */
 public interface HttpDataReceiver {
     
-    void reset(HttpParams params);
+    void configure(HttpParams params);
 
     int read(byte[] b, int off, int len) throws IOException; 
     

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataTransmitter.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataTransmitter.java?view=diff&rev=547044&r1=547043&r2=547044
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataTransmitter.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/io/HttpDataTransmitter.java
Wed Jun 13 15:07:46 2007
@@ -49,7 +49,7 @@
  */
 public interface HttpDataTransmitter {
 
-    void reset(HttpParams params);
+    void configure(HttpParams params);
 
     void write(byte[] b, int off, int len) throws IOException;
     

Modified: jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/TestHttpDataReceiverAndTransmitter.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/TestHttpDataReceiverAndTransmitter.java?view=diff&rev=547044&r1=547043&r2=547044
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/TestHttpDataReceiverAndTransmitter.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/TestHttpDataReceiverAndTransmitter.java
Wed Jun 13 15:07:46 2007
@@ -319,13 +319,13 @@
         HttpDataReceiverMockup receiver1 = new HttpDataReceiverMockup(tmp, 5);
         // no limit
         params.setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 0);
-        receiver1.reset(params);
+        receiver1.configure(params);
         assertNotNull(receiver1.readLine());
         
         HttpDataReceiverMockup receiver2 = new HttpDataReceiverMockup(tmp, 5);
         // 15 char limit
         params.setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 15);
-        receiver2.reset(params);
+        receiver2.configure(params);
         try {
             receiver2.readLine();
             fail("IOException should have been thrown");
@@ -362,7 +362,7 @@
         HttpProtocolParams.setHttpElementCharset(params, "UTF-8");
         
         HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup();
-        transmitter.reset(params);
+        transmitter.configure(params);
 
         CharArrayBuffer chbuffer = new CharArrayBuffer(16); 
         for (int i = 0; i < 10; i++) {
@@ -380,7 +380,7 @@
         
         HttpDataReceiverMockup receiver = new HttpDataReceiverMockup(
         		transmitter.getData());
-        receiver.reset(params);
+        receiver.configure(params);
 
         for (int i = 0; i < 10; i++) {
             assertEquals(s1, receiver.readLine());
@@ -398,7 +398,7 @@
         HttpProtocolParams.setHttpElementCharset(params, HTTP.ISO_8859_1);
         
         HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup();
-        transmitter.reset(params);
+        transmitter.configure(params);
 
         CharArrayBuffer chbuffer = new CharArrayBuffer(16); 
         for (int i = 0; i < 10; i++) {
@@ -411,7 +411,7 @@
         HttpDataReceiverMockup receiver = new HttpDataReceiverMockup(
                 transmitter.getData());
         HttpProtocolParams.setHttpElementCharset(params, HTTP.ISO_8859_1);
-        receiver.reset(params);
+        receiver.configure(params);
 
         for (int i = 0; i < 10; i++) {
             assertEquals(s1, receiver.readLine());

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java?view=diff&rev=547044&r1=547043&r2=547044
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
Wed Jun 13 15:07:46 2007
@@ -50,7 +50,6 @@
 import org.apache.http.nio.reactor.EventMask;
 import org.apache.http.nio.reactor.IOSession;
 import org.apache.http.nio.util.ByteBufferAllocator;
-import org.apache.http.params.HttpConnectionParams;
 import org.apache.http.params.HttpParams;
 
 public class DefaultNHttpClientConnection 
@@ -67,11 +66,8 @@
         if (responseFactory == null) {
             throw new IllegalArgumentException("Response factory may not be null");
         }
-        this.responseParser = new HttpResponseParser(
-                this.inbuf,
-                params.getIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, -1),
-                params.getIntParameter(HttpConnectionParams.MAX_HEADER_COUNT, -1),
-                responseFactory);
+        this.responseParser = new HttpResponseParser(this.inbuf, responseFactory);
+        this.responseParser.configure(params);
         this.hasBufferedInput = false;
         this.hasBufferedOutput = false;
         this.session.setBufferStatus(this);

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java?view=diff&rev=547044&r1=547043&r2=547044
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
Wed Jun 13 15:07:46 2007
@@ -50,7 +50,6 @@
 import org.apache.http.nio.reactor.EventMask;
 import org.apache.http.nio.reactor.IOSession;
 import org.apache.http.nio.util.ByteBufferAllocator;
-import org.apache.http.params.HttpConnectionParams;
 import org.apache.http.params.HttpParams;
 
 public class DefaultNHttpServerConnection 
@@ -67,11 +66,8 @@
         if (requestFactory == null) {
             throw new IllegalArgumentException("Request factory may not be null");
         }
-        this.requestParser = new HttpRequestParser(
-                this.inbuf,
-                params.getIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, -1),
-                params.getIntParameter(HttpConnectionParams.MAX_HEADER_COUNT, -1),
-                requestFactory);
+        this.requestParser = new HttpRequestParser(this.inbuf, requestFactory);
+        this.requestParser.configure(params);
     }
 
     public void resetInput() {

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpMessageParser.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpMessageParser.java?view=diff&rev=547044&r1=547043&r2=547044
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpMessageParser.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpMessageParser.java
Wed Jun 13 15:07:46 2007
@@ -40,6 +40,8 @@
 import org.apache.http.HttpMessage;
 import org.apache.http.ProtocolException;
 import org.apache.http.message.BufferedHeader;
+import org.apache.http.params.HttpConnectionParams;
+import org.apache.http.params.HttpParams;
 import org.apache.http.impl.nio.reactor.SessionInputBuffer;
 import org.apache.http.util.CharArrayBuffer;
 
@@ -58,10 +60,10 @@
     private CharArrayBuffer lineBuf;
     private final List headerBufs;
 
-    private int maxLineLen;
-    private int maxHeaderCount;
+    private int maxLineLen = -1;
+    private int maxHeaderCount = -1;
 
-    public HttpMessageParser(final SessionInputBuffer buffer, int maxLineLen, int maxHeaderCount)
{
+    public HttpMessageParser(final SessionInputBuffer buffer) {
         super();
         if (buffer == null) {
             throw new IllegalArgumentException("Session input buffer may not be null");
@@ -70,8 +72,13 @@
         this.state = READ_HEAD_LINE;
         this.endOfStream = false;
         this.headerBufs = new ArrayList();        
-        this.maxLineLen = maxLineLen;
-        this.maxHeaderCount = maxHeaderCount;
+    }
+    
+    public void configure(final HttpParams params) {
+        this.maxLineLen = params.getIntParameter(
+                HttpConnectionParams.MAX_LINE_LENGTH, -1);
+        this.maxHeaderCount = params.getIntParameter(
+                HttpConnectionParams.MAX_HEADER_COUNT, -1);
     }
     
     public void reset() {

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpRequestParser.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpRequestParser.java?view=diff&rev=547044&r1=547043&r2=547044
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpRequestParser.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpRequestParser.java
Wed Jun 13 15:07:46 2007
@@ -44,21 +44,13 @@
     private final HttpRequestFactory requestFactory;
     
     public HttpRequestParser(
-            final SessionInputBuffer buffer,
-            int maxLineLen, 
-            int maxHeaderCount,
+            final SessionInputBuffer buffer, 
             final HttpRequestFactory requestFactory) {
-        super(buffer, maxLineLen, maxHeaderCount);
+        super(buffer);
         if (requestFactory == null) {
             throw new IllegalArgumentException("Request factory may not be null");
         }
         this.requestFactory = requestFactory;
-    }
-
-    public HttpRequestParser(
-            final SessionInputBuffer buffer,
-            final HttpRequestFactory requestFactory) {
-        this(buffer, -1, -1, requestFactory);
     }
 
     protected HttpMessage createMessage(final CharArrayBuffer buffer) 

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpResponseParser.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpResponseParser.java?view=diff&rev=547044&r1=547043&r2=547044
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpResponseParser.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/HttpResponseParser.java
Wed Jun 13 15:07:46 2007
@@ -45,20 +45,12 @@
     
     public HttpResponseParser(
             final SessionInputBuffer buffer,
-            int maxLineLen, 
-            int maxHeaderCount,
             final HttpResponseFactory responseFactory) {
-        super(buffer, maxLineLen, maxHeaderCount);
+        super(buffer);
         if (responseFactory == null) {
             throw new IllegalArgumentException("Response factory may not be null");
         }
         this.responseFactory = responseFactory;
-    }
-
-    public HttpResponseParser(
-            final SessionInputBuffer buffer,
-            final HttpResponseFactory responseFactory) {
-        this(buffer, -1, -1, responseFactory);
     }
 
     protected HttpMessage createMessage(final CharArrayBuffer buffer) 

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/test/java/org/apache/http/impl/nio/codecs/TestHttpMessageParser.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/test/java/org/apache/http/impl/nio/codecs/TestHttpMessageParser.java?view=diff&rev=547044&r1=547043&r2=547044
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/test/java/org/apache/http/impl/nio/codecs/TestHttpMessageParser.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/test/java/org/apache/http/impl/nio/codecs/TestHttpMessageParser.java
Wed Jun 13 15:07:46 2007
@@ -48,6 +48,9 @@
 import org.apache.http.impl.DefaultHttpRequestFactory;
 import org.apache.http.impl.DefaultHttpResponseFactory;
 import org.apache.http.impl.nio.reactor.SessionInputBuffer;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.HttpConnectionParams;
+import org.apache.http.params.HttpParams;
 
 /**
  * Simple tests for {@link HttpMessageParser}.
@@ -323,15 +326,19 @@
     }
 
     public void testLineLimitForStatus() throws Exception {
+        HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
-        HttpRequestParser requestParser = new HttpRequestParser(inbuf, 0, -1, requestFactory);
+        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory);
 
+        params.setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 0);
+        requestParser.configure(params);        
         requestParser.fillBuffer(newChannel("GET /whatever HTTP/1.0\r\nHeader: one\r\n\r\n"));
         requestParser.parse();
         requestParser.reset();
 
-        requestParser = new HttpRequestParser(inbuf, 15, -1, requestFactory);
+        params.setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 15);
+        requestParser.configure(params);        
         try {
             requestParser.fillBuffer(newChannel("GET /loooooooooooooooong HTTP/1.0\r\nHeader:
one\r\n\r\n"));
             requestParser.parse();
@@ -341,15 +348,19 @@
     }
 
     public void testLineLimitForHeader() throws Exception {
+        HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
-        HttpRequestParser requestParser = new HttpRequestParser(inbuf, 0, -1, requestFactory);
+        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory);
 
+        params.setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 0);
+        requestParser.configure(params);
         requestParser.fillBuffer(newChannel("GET /whatever HTTP/1.0\r\nHeader: one\r\n\r\n"));
         requestParser.parse();
         requestParser.reset();
 
-        requestParser = new HttpRequestParser(inbuf, 15, -1, requestFactory);
+        params.setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 15);
+        requestParser.configure(params);
         requestParser.fillBuffer(newChannel("GET / HTTP/1.0\r\nHeader: 9012345\r\n\r\n"));
         requestParser.parse();
         requestParser.reset();
@@ -362,10 +373,14 @@
     }
 
     public void testLineLimitForFoldedHeader() throws Exception {
+        HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
-        HttpRequestParser requestParser = new HttpRequestParser(inbuf, 15, 2, requestFactory);
+        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory);
 
+        params.setIntParameter(HttpConnectionParams.MAX_HEADER_COUNT, 2);
+        params.setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 15);        
+        requestParser.configure(params);
         try {
             requestParser.fillBuffer(newChannel("GET / HTTP/1.0\r\nHeader: 9012345\r\n 23456789012345\r\n
23456789012345\r\n 23456789012345\r\n\r\n"));
             requestParser.parse();
@@ -375,10 +390,13 @@
     }
 
     public void testMaxHeaderCount() throws Exception {
+        HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBuffer(1024, 128); 
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
-        HttpRequestParser requestParser = new HttpRequestParser(inbuf, -1, 2, requestFactory);
+        HttpRequestParser requestParser = new HttpRequestParser(inbuf, requestFactory);
 
+        params.setIntParameter(HttpConnectionParams.MAX_HEADER_COUNT, 2);
+        requestParser.configure(params);
         requestParser.fillBuffer(newChannel("GET /whatever HTTP/1.0\r\nHeader: one\r\nHeader:
two\r\n\r\n"));
         requestParser.parse();
         requestParser.reset();



Mime
View raw message