jicarilla-sandbox/platform/components/http/impl/src/java/org/jicarilla/http HTTPParserImpl.java,1.10,1.11

Leo Simons <[email protected]>
Newsgroups gmane.comp.java.jicarilla.cvs
Message-ID <[email protected]>
Update of /cvsroot/jicarilla/jicarilla-sandbox/platform/components/http/impl/src/java/org/jicarilla/http
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7227/platform/components/http/impl/src/java/org/jicarilla/http

Modified Files:
	HTTPParserImpl.java 
Log Message:
finish support for trailers

Index: HTTPParserImpl.java
===================================================================
RCS file: /cvsroot/jicarilla/jicarilla-sandbox/platform/components/http/impl/src/java/org/jicarilla/http/HTTPParserImpl.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- HTTPParserImpl.java	3 Apr 2004 10:13:24 -0000	1.10
+++ HTTPParserImpl.java	4 Apr 2004 14:16:45 -0000	1.11
@@ -938,11 +938,6 @@
                 {
                     getContext().skipLF();
                     
-                    // todo check for CR
-                    if( getContext().view.remaining() <= 1 )
-                    {
-                        foundTrailerValue();
-                    }
                     getContext().state =
                             LOOKING_FOR_TRAILER_VALUE_OR_NEXT_TRAILER;
                 }
@@ -1303,7 +1298,7 @@
         getContext().state = SKIPPING_WHITESPACE_AFTER_TRAILER_NAME;
     }
 
-    protected void foundTrailerValue()
+    protected void foundTrailerValue() throws HTTPException
     {
         final int newLimit = getContext().source.position() -
                 getContext().slice - 3;
@@ -1312,15 +1307,19 @@
         getHandler().foundTrailerValue(
                 getContext().getAndUnsetView() );
 
-        boolean trailersFinished = true;
-        for( int i = 0; i < getContext().expectedTrailers.length; i++ )
-        {
-            String trailer = getContext().expectedTrailers[i];
-            if(trailer != null ) trailersFinished = false;
-        }
-        
-        if( trailersFinished )
+        if( getContext().ch == HTTPEncoding.CR )
         {
+            for( int i = 0; i < getContext().expectedTrailers.length; i++ )
+            {
+                String trailer = getContext().expectedTrailers[i];
+                if(trailer != null )
+                {
+                    m_errorHandler.exceptionOccurred(
+                        new HTTPException( HTTPEncoding.STATUS_400_Bad_Request,
+                        "Missing trailer '" + trailer + "'!" ) );
+                }
+            }
+            getContext().skipLF();
             getContext().state = DONE;
             getHandler().endMessage();
         }



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.