Commit 74ebc38f authored by justcoding121's avatar justcoding121

cleanup header writer

parent 2f96a6a4
...@@ -107,7 +107,7 @@ namespace Titanium.Web.Proxy.Helpers ...@@ -107,7 +107,7 @@ namespace Titanium.Web.Proxy.Helpers
var headerBuilder = new StringBuilder(); var headerBuilder = new StringBuilder();
foreach (var header in headers) foreach (var header in headers)
{ {
header.Write(headerBuilder); headerBuilder.AppendLine(header.ToString());
} }
headerBuilder.AppendLine(); headerBuilder.AppendLine();
......
...@@ -103,9 +103,8 @@ namespace Titanium.Web.Proxy.Http ...@@ -103,9 +103,8 @@ namespace Titanium.Web.Proxy.Http
&& !string.IsNullOrEmpty(upstreamProxy.UserName) && !string.IsNullOrEmpty(upstreamProxy.UserName)
&& upstreamProxy.Password != null) && upstreamProxy.Password != null)
{ {
HttpHeader.ProxyConnectionKeepAlive.Write(headerBuilder); headerBuilder.AppendLine(HttpHeader.ProxyConnectionKeepAlive.ToString());
HttpHeader.GetProxyAuthorizationHeader(upstreamProxy.UserName, upstreamProxy.Password) headerBuilder.AppendLine(HttpHeader.GetProxyAuthorizationHeader(upstreamProxy.UserName, upstreamProxy.Password).ToString());
.Write(headerBuilder);
} }
// write request headers // write request headers
...@@ -113,7 +112,7 @@ namespace Titanium.Web.Proxy.Http ...@@ -113,7 +112,7 @@ namespace Titanium.Web.Proxy.Http
{ {
if (isTransparent || header.Name != KnownHeaders.ProxyAuthorization) if (isTransparent || header.Name != KnownHeaders.ProxyAuthorization)
{ {
header.Write(headerBuilder); headerBuilder.AppendLine(header.ToString());
} }
} }
......
...@@ -60,10 +60,5 @@ namespace Titanium.Web.Proxy.Models ...@@ -60,10 +60,5 @@ namespace Titanium.Web.Proxy.Models
"Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes($"{userName}:{password}"))); "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes($"{userName}:{password}")));
return result; return result;
} }
internal void Write(StringBuilder writer)
{
writer.AppendLine($"{Name}: {Value}");
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment