SocketServer HTTP POST Request

Hi
To debug JAVASCRIPT on remote computer I use jquery post and json encoded data of objects. To receive request I use CHRISTOPHE
http://coenraets.org/blog/2009/12/air-2-0-web-server-using-the-new-server-socket-api/
SocketServer example

All works and I have trace of request in my text field.

But how can separate headers form body in post request?
I tried search for "

" but it gives -1;

Another question how to detect End of body to close Socket?
sometimes data coming in multiplay requests.

In example all data in ByteArray and reading request looks like this:

 
 private function socketDataHandler(event:ProgressEvent):void      {

       var socket:Socket = event.target as Socket;
       var bytes:ByteArray = new ByteArray();
       socket.readBytes(bytes);

var fullRequest:String=bytes.readUTFByetes(bytes.bytesAvailable);

var headerEnd:int=fullRequest.indexOf("

");// trace -1;

............................................