public static void WriteHttpTrace(this StringBuilder stringBuilder, HttpMessageHeader messageHeader) { if (messageHeader == null) { return; } stringBuilder .AppendFormat("StartLine: {0}", messageHeader.StartLine) .AppendLine(); var headers = messageHeader.Headers.Lines.ToList(); if (headers.Count == 0) { return; } stringBuilder.AppendLine("Headers:"); foreach (var header in headers) { stringBuilder .AppendFormat(" {0}", header) .AppendLine(); } }
public static String GetHttpTrace(HttpMessageHeader header) { if (header == null) { return String.Empty; } var sb = new StringBuilder(); WriteHttpTrace(sb, header); return sb.ToString(); }
protected override void WriteBody(HttpMessageHeader header, Stream body, Int64 bodyLength) { if (!IsRedirect(header as HttpResponseHeader)) { base.WriteBody(header, body, bodyLength); } else { if (Logger.IsDebugEnabled) { Logger.Debug("Skipping redirect response body"); } } }
public HttpResponseHeader(HttpMessageHeader header) : base(header.StartLine, header.Headers) { StartLine = base.StartLine; }
/// <summary> /// Convert generic <see cref="HttpMessageHeader"/> to <see cref="HttpResponseHeader"/> /// </summary> /// <param name="header">generic HTTP header</param> /// <returns>HTTP request message header</returns> public HttpRequestHeader(HttpMessageHeader header) : base(header.StartLine, header.Headers) { StartLine = header.StartLine; }
public MessageWriterTestCaseBuilder(HttpMessageHeader header, String body) { _messageBody = body; _httpMessageHeader = header; }
public String ShouldWriteHttpMessage(HttpMessageHeader header, Stream body, long? bodyLength) { var outputStream = new MemoryStream(); var httpWriter = new HttpMessageWriter(outputStream); httpWriter.Write(header, body, bodyLength); return Encoding.ASCII.GetString(outputStream.ToArray()); }