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); }
private void ResetCurrentHttpMessage() { this.currentHttpMessage = new HttpMessage(this.Settings); }
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]); }
public void EnqueueHttpMessage(HttpMessage message) { this.httpMessageQueue.Enqueue(message); }
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; } } }
private bool EnsureCurrentMessage() { if (this.currentMessage == null) { HttpMessage message; if (!this.httpMessageQueue.TryDequeue(out message)) { return false; } this.currentMessage = message; } return true; }