Exemplo n.º 1
0
 public void Clear()
 {
     Request = null;
     _stdinHeader = null;
     _stdinDataReceivedLength = 0;
     EndOfRequest = false;
     AbortRequest = false;
 }
Exemplo n.º 2
0
        public int ParseRequest(byte[] buffer, int offset, int length)
        {
            int endOffset = offset + length;

            while (offset < endOffset)
            {
                FastCGIHeader header = new FastCGIHeader(buffer, offset);
                if (header.RequestId != 0)
                {
                    if (Request == null)
                        Request = new FastCGIRequest();

                    offset += FastCGIHeader.LENGTH;

                    if (header.Type == FastCGIHeader.TYPE.BEGIN_REQUEST)
                    {
                        Request.BeginRequestRecord = new BeginRequestRecord()
                        {
                            Header = header,
                            Body = new BeginRequestBody(buffer, offset)
                        };
                        offset += header.ContentLength;
                    }
                    else if (header.Type == FastCGIHeader.TYPE.PARAMS)
                    {
                        offset = Request.ParseParams(header, buffer, offset, endOffset);
                    }
                    else
                    {
                        offset -= FastCGIHeader.LENGTH;
                        break;
                    }

                    offset += header.PaddingLength;
                }
            }

            #if DEBUG
            Log();
            #endif

            return offset;
        }