88using Titanium . Web . Proxy . Extensions ;
99using Titanium . Web . Proxy . Models ;
1010using Titanium . Web . Proxy . Network . Tcp ;
11+ using Titanium . Web . Proxy . Shared ;
1112
1213namespace Titanium . Web . Proxy . Http
1314{
@@ -16,8 +17,6 @@ namespace Titanium.Web.Proxy.Http
1617 /// </summary>
1718 public class HttpWebClient
1819 {
19- private const string CRLF = "\r \n " ;
20-
2120 internal HttpWebClient ( Request request = null , Response response = null )
2221 {
2322 Request = request ?? new Request ( ) ;
@@ -111,21 +110,20 @@ await writer.WriteLineAsync(Request.CreateRequestLine(Request.Method,
111110 && ! string . IsNullOrEmpty ( upstreamProxy . UserName )
112111 && upstreamProxy . Password != null )
113112 {
114- headerBuilder . AppendFormat ( "{0}{1}" , HttpHeader . ProxyConnectionKeepAlive , CRLF ) ;
115- headerBuilder . AppendFormat ( "{0}{1}" ,
116- HttpHeader . GetProxyAuthorizationHeader ( upstreamProxy . UserName , upstreamProxy . Password ) , CRLF ) ;
113+ headerBuilder . Append ( $ "{ HttpHeader . ProxyConnectionKeepAlive } { ProxyConstants . NewLine } ") ;
114+ headerBuilder . Append ( $ "{ HttpHeader . GetProxyAuthorizationHeader ( upstreamProxy . UserName , upstreamProxy . Password ) } { ProxyConstants . NewLine } ") ;
117115 }
118116
119117 // write request headers
120118 foreach ( var header in Request . Headers )
121119 {
122120 if ( isTransparent || header . Name != KnownHeaders . ProxyAuthorization )
123121 {
124- headerBuilder . AppendFormat ( "{0}{1}" , header , CRLF ) ;
122+ headerBuilder . Append ( $ " { header } { ProxyConstants . NewLine } " ) ;
125123 }
126124 }
127125
128- headerBuilder . Append ( CRLF ) ;
126+ headerBuilder . Append ( ProxyConstants . NewLine ) ;
129127
130128 await writer . WriteAsync ( headerBuilder . ToString ( ) , cancellationToken ) ;
131129
0 commit comments