You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2010/02/23 07:36:45 UTC

svn commit: r915200 - in /james/server/trunk: mina-socket/src/main/java/org/apache/james/socket/mina/codec/ smtpserver/src/main/java/org/apache/james/smtpserver/mina/

Author: norman
Date: Tue Feb 23 06:36:44 2010
New Revision: 915200

URL: http://svn.apache.org/viewvc?rev=915200&view=rev
Log:
Revert changes related to disabling line length checkin in DATA command of SMTP.
Higher the limit 

Modified:
    james/server/trunk/mina-socket/src/main/java/org/apache/james/socket/mina/codec/CRLFTerminatedLineDecoder.java
    james/server/trunk/mina-socket/src/main/java/org/apache/james/socket/mina/codec/JamesProtocolCodecFactory.java
    james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/mina/SMTPSessionImpl.java

Modified: james/server/trunk/mina-socket/src/main/java/org/apache/james/socket/mina/codec/CRLFTerminatedLineDecoder.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mina-socket/src/main/java/org/apache/james/socket/mina/codec/CRLFTerminatedLineDecoder.java?rev=915200&r1=915199&r2=915200&view=diff
==============================================================================
--- james/server/trunk/mina-socket/src/main/java/org/apache/james/socket/mina/codec/CRLFTerminatedLineDecoder.java (original)
+++ james/server/trunk/mina-socket/src/main/java/org/apache/james/socket/mina/codec/CRLFTerminatedLineDecoder.java Tue Feb 23 06:36:44 2010
@@ -33,10 +33,8 @@
 public class CRLFTerminatedLineDecoder extends CumulativeProtocolDecoder {
 
     private int maxLineLength;
-
-    private boolean check = true;
     
-    public static int DEFAULT_MAX_LINE_LENTH = 2048;
+    public static int DEFAULT_MAX_LINE_LENTH = 20480;
     
     /**
      * Construct new instance with a max line length given (chars per line). 
@@ -54,11 +52,7 @@
     public CRLFTerminatedLineDecoder() {
         this(DEFAULT_MAX_LINE_LENTH);
     }
-   
     
-    public synchronized void checkLineLengthLimit(boolean check) {
-        this.check = check;
-    }
     
     /*
      * (non-Javadoc)
@@ -75,7 +69,7 @@
         // Now find the first CRLF in the buffer.
         byte previous = 0;
         
-        if (check && maxLineLength != -1 && in.remaining() > maxLineLength) {
+        if (maxLineLength != -1 && in.remaining() > maxLineLength) {
             
             // clear the buffer before throw exception
             in.clear();

Modified: james/server/trunk/mina-socket/src/main/java/org/apache/james/socket/mina/codec/JamesProtocolCodecFactory.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mina-socket/src/main/java/org/apache/james/socket/mina/codec/JamesProtocolCodecFactory.java?rev=915200&r1=915199&r2=915200&view=diff
==============================================================================
--- james/server/trunk/mina-socket/src/main/java/org/apache/james/socket/mina/codec/JamesProtocolCodecFactory.java (original)
+++ james/server/trunk/mina-socket/src/main/java/org/apache/james/socket/mina/codec/JamesProtocolCodecFactory.java Tue Feb 23 06:36:44 2010
@@ -21,7 +21,6 @@
 
 import java.nio.charset.Charset;
 
-import org.apache.mina.core.session.AttributeKey;
 import org.apache.mina.core.session.IoSession;
 import org.apache.mina.filter.codec.ProtocolCodecFactory;
 import org.apache.mina.filter.codec.ProtocolDecoder;
@@ -35,9 +34,7 @@
  *
  */
 public class JamesProtocolCodecFactory  implements ProtocolCodecFactory {
-    public static final AttributeKey DECODER_KEY = new AttributeKey(CRLFTerminatedLineDecoder.class,"decoder");
-    public static final AttributeKey ENCODER_KEY = new AttributeKey(TextLineEncoder.class,"encoder");
-
+    
     private final ProtocolEncoder encoder = new TextLineEncoder(Charset.forName("US-ASCII"), LineDelimiter.CRLF);
     private final ProtocolDecoder decoder = new CRLFTerminatedLineDecoder();
     
@@ -46,8 +43,6 @@
      * @see org.apache.mina.filter.codec.ProtocolCodecFactory#getEncoder(org.apache.mina.core.session.IoSession)
      */
     public ProtocolEncoder getEncoder(IoSession arg0) throws Exception {
-        arg0.setAttribute(ENCODER_KEY,encoder);
-
         return encoder;
     }
     
@@ -56,7 +51,6 @@
      * @see org.apache.mina.filter.codec.ProtocolCodecFactory#getDecoder(org.apache.mina.core.session.IoSession)
      */
     public ProtocolDecoder getDecoder(IoSession arg0) throws Exception {
-        arg0.setAttribute(DECODER_KEY,decoder);
         return decoder;
     }
 }

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/mina/SMTPSessionImpl.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/mina/SMTPSessionImpl.java?rev=915200&r1=915199&r2=915200&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/mina/SMTPSessionImpl.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/mina/SMTPSessionImpl.java Tue Feb 23 06:36:44 2010
@@ -33,8 +33,6 @@
 import org.apache.james.smtpserver.mina.filter.SMTPResponseFilter;
 import org.apache.james.smtpserver.mina.filter.TarpitFilter;
 import org.apache.james.socket.mina.AbstractMINASession;
-import org.apache.james.socket.mina.codec.CRLFTerminatedLineDecoder;
-import org.apache.james.socket.mina.codec.JamesProtocolCodecFactory;
 import org.apache.james.socket.mina.filter.FilterLineHandlerAdapter;
 import org.apache.mina.core.session.IoSession;
 
@@ -115,7 +113,6 @@
             if (currentHeloMode != null) {
                 getState().put(CURRENT_HELO_MODE, currentHeloMode);
             }
-            
         }
 
         /**
@@ -125,9 +122,6 @@
             getIoSession().getFilterChain()
                     .remove("lineHandler" + lineHandlerCount);
             lineHandlerCount--;
-            if (lineHandlerCount == 0) {
-                ((CRLFTerminatedLineDecoder)getIoSession().getAttribute(JamesProtocolCodecFactory.DECODER_KEY)).checkLineLengthLimit(true);
-            }
         }
 
         /**
@@ -138,10 +132,6 @@
             getIoSession().getFilterChain().addAfter(SMTPResponseFilter.NAME,
                     "lineHandler" + lineHandlerCount,
                     new FilterLineHandlerAdapter<SMTPSession>(overrideCommandHandler,SMTP_SESSION));
-            // disable the line length limit because we are processing the data
-            // not sure if this is the right place todo this
-            ((CRLFTerminatedLineDecoder)getIoSession().getAttribute(JamesProtocolCodecFactory.DECODER_KEY)).checkLineLengthLimit(false);
-            
         }
 
 



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