Index: extras/ajp/src/main/java/org/mortbay/jetty/ajp/Ajp13Parser.java
===================================================================
--- extras/ajp/src/main/java/org/mortbay/jetty/ajp/Ajp13Parser.java	(revision 2043)
+++ extras/ajp/src/main/java/org/mortbay/jetty/ajp/Ajp13Parser.java	(working copy)
@@ -342,7 +342,9 @@
                 if (bufHeaderName != null && bufHeaderName.toString().equals(Ajp13RequestHeaders.CONTENT_LENGTH))
                 {
                     _contentLength = BufferUtil.toLong(bufHeaderValue);
-                    if (_contentLength <= 0)
+
+
+                    if (_contentLength == 0)
                         _contentLength = HttpTokens.NO_CONTENT;
                 }
 
@@ -464,7 +466,7 @@
             _contentPosition = 0;
             switch ((int) _contentLength)
             {
-                case HttpTokens.UNKNOWN_CONTENT:
+
                 case HttpTokens.NO_CONTENT:
                     _state = STATE_END;
                     _handler.headerComplete();
@@ -472,6 +474,29 @@
 
                     break;
 
+                case HttpTokens.UNKNOWN_CONTENT:
+
+                    if (_buffers != null && _body == null && _buffer == _header && _header.length() <= 0)
+                    {
+                        _body = _buffers.getBuffer(Ajp13Packet.MAX_PACKET_SIZE);
+                        _body.clear();
+
+                    }
+
+                    _state = STATE_AJP13CHUNK_START;
+
+                    _generator.getBodyChunk();
+
+                    total_filled += fill();
+                    _generator.gotBody();
+
+
+                    _handler.headerComplete(); // May recurse here!
+
+
+                    return total_filled;
+
+
                 default:
 
                     if (_buffers != null && _body == null && _buffer == _header && _contentLength > (_header.capacity() - _header.getIndex()))
@@ -514,6 +539,7 @@
                     if (_chunkLength==0)
                     {
                         _state=STATE_END;
+                         _generator.gotBody();
                         _handler.messageComplete(_contentPosition);
                         return total_filled;
                     }
@@ -534,7 +560,7 @@
                     if (remaining==0)
                     {
                         _state=STATE_AJP13CHUNK_START;
-                        if (_contentPosition<_contentLength)
+                        if (_contentPosition < _contentLength || _contentLength == HttpTokens.UNKNOWN_CONTENT)
                         {
                             _generator.getBodyChunk();
                         }
@@ -561,7 +587,7 @@
                     if (remaining==0)
                     {
                         _state=STATE_AJP13CHUNK_START;
-                        if (_contentPosition<_contentLength)
+                        if (_contentPosition < _contentLength || _contentLength == HttpTokens.UNKNOWN_CONTENT)
                         {
                             _generator.getBodyChunk();
                         }
Index: extras/ajp/src/test/java/org/mortbay/jetty/ajp/HttpClientPostChunked.java
===================================================================
--- extras/ajp/src/test/java/org/mortbay/jetty/ajp/HttpClientPostChunked.java	(revision 0)
+++ extras/ajp/src/test/java/org/mortbay/jetty/ajp/HttpClientPostChunked.java	(revision 0)
@@ -0,0 +1,73 @@
+package org.mortbay.jetty.ajp;
+
+import java.io.PrintWriter;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import java.net.UnknownHostException;
+import java.net.URL;
+
+
+public class HttpClientPostChunked
+{
+    public static void main(String args[])
+    {
+
+        try
+        {
+
+            String urlAddress = "http://192.168.245.149/bong/SamplePost.htm";
+            System.out.println("Address: " + urlAddress);
+            URL url = new URL(urlAddress);
+            HttpURLConnection con = (HttpURLConnection)url.openConnection();
+            con.setDoOutput(true);
+            con.setRequestMethod("POST");
+
+            con.setChunkedStreamingMode(8);
+            PrintWriter pw = new PrintWriter(new OutputStreamWriter(con.getOutputStream()));
+
+
+
+            pw.write("thename=the quick brown fox jumps over to the lazy dog THE QUICK BROWN FOX JUMPS OVER TO THE LAZY DOG ");
+            pw.write("the quick brown fox jumps over to the lazy dog THE QUICK BROWN FOX JUMPS OVER TO THE LAZY DOG ");
+            pw.write("the quick brown fox jumps over to the lazy dog THE QUICK BROWN FOX JUMPS OVER TO THE LAZY DOG ");
+            pw.write("the quick brown fox jumps over to the lazy dog THE QUICK BROWN FOX JUMPS OVER TO THE LAZY DOG ");
+            pw.write("the quick brown fox jumps over to the lazy dog THE QUICK BROWN FOX JUMPS OVER TO THE LAZY DOG ");
+            pw.write("the quick brown fox jumps over to the lazy dog THE QUICK BROWN FOX JUMPS OVER TO THE LAZY DOG ");
+            pw.write("the quick brown fox jumps over to the lazy dog THE QUICK BROWN FOX JUMPS OVER TO THE LAZY DOG ");
+            pw.write("the quick brown fox jumps over to the lazy dog THE QUICK BROWN FOX JUMPS OVER TO THE LAZY DOG ");
+            pw.write("the quick brown fox jumps over to the lazy dog THE QUICK BROWN FOX JUMPS OVER TO THE LAZY DOG ");
+            pw.write("the quick brown fox jumps over to the lazy dog THE QUICK BROWN FOX JUMPS OVER TO THE LAZY DOG ");
+            pw.write("the quick brown fox jumps over to the lazy dog THE QUICK BROWN FOX JUMPS OVER TO THE LAZY DOG ");
+            pw.write("the quick brown fox jumps over to the lazy dog THE QUICK BROWN FOX JUMPS OVER TO THE LAZY DOG ");
+            pw.write("the quick brown fox jumps over to the lazy dog THE QUICK BROWN FOX JUMPS OVER TO THE LAZY DOG!!! ");
+            pw.write("&valueof2=abcdefghijklmnopqrstuvwxyz1234567890");
+            pw.flush();
+
+            System.out.println("\n\n\nResponse Code is " + con.getResponseCode());
+            System.out.println("\n\n\n");
+
+            byte[] b = new byte[10];
+            while(con.getInputStream().read(b) > 0)
+            {
+                String str = new String(b);
+                System.out.print(str);
+
+            }
+
+
+
+            pw.close();
+        }
+        catch (UnknownHostException e)
+        {
+            System.err.println(e);
+        }
+        catch (IOException e)
+        {
+            System.err.println(e);
+        }
+
+    }
+}
+
Index: VERSION.txt
===================================================================
--- VERSION.txt	(revision 2043)
+++ VERSION.txt	(working copy)
@@ -1,4 +1,5 @@
 jetty-SNAPSHOT
+ + AJP13 Fix on chunked post
  + Fix cached header optimization for extra characters
  + SetUID option to support setgid
  + Make mx4j used only if runtime uses jdk<1.5
@@ -3273,3 +3274,5 @@
 
 
 
+
+

