private static SoapCsvMessageLoggerFields FormatMessage(HttpMessage message)
 {
     return new SoapCsvMessageLoggerFields
     {
         //Time = GetTime(message.RequestStartTime),
         Location = message.Request.Location,
         //SoapAction = message.Request.SoapAction ?? message.Response.SoapAction,
         RequestContentLength = message.Request.LoadedContentLength.ToString(),
         ResponseContentLength = message.Response.LoadedContentLength.ToString(),
         //RequestMiliseconds = ((int)message.ElapsedTime.TotalMilliseconds).ToString()
     };
 }
 public void LogMessageFinished(HttpMessage message)
 {
     this.finishedMessagesQueue.Add(message);
 }
Exemple #3
0
 private void ResetCurrentHttpMessage()
 {
     this.currentHttpMessage = new HttpMessage(this.Settings);
 }
Exemple #4
0
        public void InitFromSummary(HttpHeadersSummary summary, HttpMessage httpMessage)
        {
            if (summary.StatusLine.Count < 2 || summary.StatusLine.Count > 3)
            {
                throw new InvalidOperationException("First line of HTTP request should consist of 3 parts");
            }

            this.ContentLength = summary.ContentLength.GetValueOrDefault(0);
            this.HttpVersion = summary.StatusLine[0];
            this.Status = summary.StatusLine[1];
            this.Reason = summary.StatusLine.Count == 3 ? summary.StatusLine[2] : null;
            this.Headers = summary.Headers;
            this.HeaderLength = summary.HeaderLength;

            var transferEncodingValue = this.Headers[TransferEncodingHeaderName].FirstOrDefault();
            if (transferEncodingValue != null && transferEncodingValue.ToUpperInvariant() == ChunkedTransferValue)
            {
                this.IsChunkedTransfer = true;
            }

            this.IsInitialized = true;

            // Recalculate LoadedContentLength and ExtraContentOffset
            this.AddContent(new byte[0]);
        }
Exemple #5
0
 public void EnqueueHttpMessage(HttpMessage message)
 {
     this.httpMessageQueue.Enqueue(message);
 }
Exemple #6
0
        private void UpdateCurrentMessage(byte[] data)
        {
            while (data != null)
            {
                if (!this.EnsureCurrentMessage())
                {
                    return;
                }

                this.currentMessage.AddResponseData(data);

                if (!this.currentMessage.Response.FinishedLoading)
                {
                    return;
                }

                data = Utils.GetOffsetContent(data, this.currentMessage.Response.ExtraContentOffset);

                if (this.currentMessage.Response.IsContinueResponse)
                {
                    this.currentMessage.Response = new HttpResponseInfo();
                }
                else
                {
                    this.StopCurrentMessage();
                    this.currentMessage = null;
                }
            }
        }
Exemple #7
0
        private bool EnsureCurrentMessage()
        {
            if (this.currentMessage == null)
            {
                HttpMessage message;
                if (!this.httpMessageQueue.TryDequeue(out message))
                {
                    return false;
                }

                this.currentMessage = message;
            }

            return true;
        }