Microsoft.Protocols.TestTools.StackSdk.BranchCache.Pchc.PCHCServer.DecomposeHttpRequest C# (CSharp) Méthode

DecomposeHttpRequest() private méthode

Get the request body byte array from the specified http request.
/// Throw when an operation is performed on a disposed object. ///
private DecomposeHttpRequest ( HttpListenerRequest httpListenerRequest ) : void
httpListenerRequest System.Net.HttpListenerRequest The specified http request.
Résultat void
        private void DecomposeHttpRequest(HttpListenerRequest httpListenerRequest)
        {
            if (httpListenerRequest == null)
            {
                throw new ArgumentNullException("httpListenerRequest");
            }

            this.httpRequestUri = httpListenerRequest.Url;
            this.httpRequestMethod = httpListenerRequest.HttpMethod;

            try
            {
                Stream requestStream = httpListenerRequest.InputStream;

                byte[] payloadBuffer = new byte[this.bufferSize];
                int readSize = 0;
                while (true)
                {
                    int tempIndex = 0;
                    readSize = requestStream.Read(payloadBuffer, 0, payloadBuffer.Length);
                    if (readSize == 0)
                    {
                        break;
                    }
                    else
                    {
                        this.httpRequestPayload = DecodeMessage.GetBytes(payloadBuffer, ref tempIndex, readSize);
                    }
                }

                requestStream.Close();
            }
            catch (ObjectDisposedException e)
            {
                if (this.logger != null)
                {
                    this.logger.AddWarning(
                        string.Format("Object disposed exception is catched, detailed information: {0}.", e.Message));
                }
                else
                {
                    throw;
                }
            }

            if (this.logger != null)
            {
                this.logger.AddDebug("Unmarshal PCHC request message is successfully.");
            }
        }