/// <summary> /// This method is called internally when data is received and fed to this Request. It basically sets this request's properties /// or appends data to the streams. Override it and call the base method itself to implement your own logics and checking. /// </summary> protected virtual void AddReceivedRecord(RecordBase rec) { if (rec == null) { throw new ArgumentNullException("rec"); } switch (rec.RecordType) { case RecordType.FCGIBeginRequest: // Make sure we are not getting a BeginRequest once again, as this could be serious. if (BeginRequestReceived) { throw new InvalidOperationException("A BeginRequest Record has already been received by this Request"); } BeginRequestReceived = true; RequestId = ((BeginRequestRecord)rec).RequestId; break; case RecordType.FCGIEndRequest: // Make sure we are not getting a BeginRequest once again, as this could be serious. if (EndRequestReceived) { throw new InvalidOperationException("An EndRequest Record has already been received by this Request"); } EndRequestReceived = true; break; case RecordType.FCGIParams: Params.AppendStream(((StreamRecordBase)rec).Contents); break; case RecordType.FCGIStdin: Stdin.AppendStream(((StreamRecordBase)rec).Contents); break; case RecordType.FCGIStdout: Stdout.AppendStream(((StreamRecordBase)rec).Contents); break; case RecordType.FCGIStderr: Stderr.AppendStream(((StreamRecordBase)rec).Contents); break; } }