Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Titanium-Web-Proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Titanium-Web-Proxy
Commits
3bf4649c
Commit
3bf4649c
authored
May 01, 2018
by
Honfika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stylecop fixes
parent
875ba62f
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
218 additions
and
63 deletions
+218
-63
SessionEventArgsBase.cs
Titanium.Web.Proxy/EventArguments/SessionEventArgsBase.cs
+1
-1
TunnelConnectEventArgs.cs
Titanium.Web.Proxy/EventArguments/TunnelConnectEventArgs.cs
+1
-0
ProxyAuthorizationException.cs
Titanium.Web.Proxy/Exceptions/ProxyAuthorizationException.cs
+1
-1
ProxyConnectException.cs
Titanium.Web.Proxy/Exceptions/ProxyConnectException.cs
+1
-1
ProxyException.cs
Titanium.Web.Proxy/Exceptions/ProxyException.cs
+4
-2
ProxyHttpException.cs
Titanium.Web.Proxy/Exceptions/ProxyHttpException.cs
+1
-1
ExplicitClientHandler.cs
Titanium.Web.Proxy/ExplicitClientHandler.cs
+2
-2
SslExtensions.cs
Titanium.Web.Proxy/Extensions/SslExtensions.cs
+2
-0
HttpHelper.cs
Titanium.Web.Proxy/Helpers/HttpHelper.cs
+1
-1
Network.cs
Titanium.Web.Proxy/Helpers/Network.cs
+1
-0
SystemProxy.cs
Titanium.Web.Proxy/Helpers/SystemProxy.cs
+2
-1
HttpWebClient.cs
Titanium.Web.Proxy/Http/HttpWebClient.cs
+1
-2
Request.cs
Titanium.Web.Proxy/Http/Request.cs
+1
-1
RequestResponseBase.cs
Titanium.Web.Proxy/Http/RequestResponseBase.cs
+6
-2
Response.cs
Titanium.Web.Proxy/Http/Response.cs
+1
-1
GenericResponse.cs
Titanium.Web.Proxy/Http/Responses/GenericResponse.cs
+3
-3
RedirectResponse.cs
Titanium.Web.Proxy/Http/Responses/RedirectResponse.cs
+1
-1
CertificateManager.cs
Titanium.Web.Proxy/Network/CertificateManager.cs
+8
-12
Message.cs
Titanium.Web.Proxy/Network/WinAuth/Security/Message.cs
+0
-2
WinAuthEndPoint.cs
...ium.Web.Proxy/Network/WinAuth/Security/WinAuthEndPoint.cs
+6
-11
WinAuthHandler.cs
Titanium.Web.Proxy/Network/WinAuth/WinAuthHandler.cs
+1
-2
ProxyServer.cs
Titanium.Web.Proxy/ProxyServer.cs
+4
-5
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+4
-7
ResponseHandler.cs
Titanium.Web.Proxy/ResponseHandler.cs
+2
-1
Settings.StyleCop
Titanium.Web.Proxy/Settings.StyleCop
+159
-0
TransparentClientHandler.cs
Titanium.Web.Proxy/TransparentClientHandler.cs
+2
-2
WinAuthHandler.cs
Titanium.Web.Proxy/WinAuthHandler.cs
+2
-1
No files found.
Titanium.Web.Proxy/EventArguments/SessionEventArgsBase.cs
View file @
3bf4649c
...
...
@@ -27,7 +27,7 @@ namespace Titanium.Web.Proxy.EventArguments
protected
readonly
ExceptionHandler
ExceptionFunc
;
/// <summary>
///
Constructor to initialize the proxy
///
Initializes a new instance of the <see cref="SessionEventArgsBase" /> class.
/// </summary>
internal
SessionEventArgsBase
(
int
bufferSize
,
ProxyEndPoint
endPoint
,
CancellationTokenSource
cancellationTokenSource
,
ExceptionHandler
exceptionFunc
)
...
...
Titanium.Web.Proxy/EventArguments/TunnelConnectEventArgs.cs
View file @
3bf4649c
...
...
@@ -37,6 +37,7 @@ namespace Titanium.Web.Proxy.EventArguments
{
get
=>
isHttpsConnect
??
throw
new
Exception
(
"The value of this property is known in the BeforeTunnectConnectResponse event"
);
internal
set
=>
isHttpsConnect
=
value
;
}
}
...
...
Titanium.Web.Proxy/Exceptions/ProxyAuthorizationException.cs
View file @
3bf4649c
...
...
@@ -11,7 +11,7 @@ namespace Titanium.Web.Proxy.Exceptions
public
class
ProxyAuthorizationException
:
ProxyException
{
/// <summary>
/// In
stantiate new instance
.
/// In
itializes a new instance of the <see cref="ProxyAuthorizationException" /> class
.
/// </summary>
/// <param name="message">Exception message.</param>
/// <param name="session">The <see cref="SessionEventArgs" /> instance containing the event data.</param>
...
...
Titanium.Web.Proxy/Exceptions/ProxyConnectException.cs
View file @
3bf4649c
...
...
@@ -9,7 +9,7 @@ namespace Titanium.Web.Proxy.Exceptions
public
class
ProxyConnectException
:
ProxyException
{
/// <summary>
/// In
stantiate new instance
/// In
itializes a new instance of the <see cref="ProxyConnectException" /> class.
/// </summary>
/// <param name="message">Message for this exception</param>
/// <param name="innerException">Associated inner exception</param>
...
...
Titanium.Web.Proxy/Exceptions/ProxyException.cs
View file @
3bf4649c
...
...
@@ -8,7 +8,8 @@ namespace Titanium.Web.Proxy.Exceptions
public
abstract
class
ProxyException
:
Exception
{
/// <summary>
/// Instantiate a new instance of this exception - must be invoked by derived classes' constructors
/// Initializes a new instance of the <see cref="ProxyException" /> class.
/// - must be invoked by derived classes' constructors
/// </summary>
/// <param name="message">Exception message</param>
protected
ProxyException
(
string
message
)
:
base
(
message
)
...
...
@@ -16,7 +17,8 @@ namespace Titanium.Web.Proxy.Exceptions
}
/// <summary>
/// Instantiate this exception - must be invoked by derived classes' constructors
/// Initializes a new instance of the <see cref="ProxyException" /> class.
/// - must be invoked by derived classes' constructors
/// </summary>
/// <param name="message">Excception message</param>
/// <param name="innerException">Inner exception associated</param>
...
...
Titanium.Web.Proxy/Exceptions/ProxyHttpException.cs
View file @
3bf4649c
...
...
@@ -9,7 +9,7 @@ namespace Titanium.Web.Proxy.Exceptions
public
class
ProxyHttpException
:
ProxyException
{
/// <summary>
/// In
stantiate new instance
/// In
itializes a new instance of the <see cref="ProxyHttpException" /> class.
/// </summary>
/// <param name="message">Message for this exception</param>
/// <param name="innerException">Associated inner exception</param>
...
...
Titanium.Web.Proxy/ExplicitClientHandler.cs
View file @
3bf4649c
...
...
@@ -20,7 +20,7 @@ using Titanium.Web.Proxy.Network.Tcp;
namespace
Titanium.Web.Proxy
{
partial
class
ProxyServer
p
ublic
p
artial
class
ProxyServer
{
/// <summary>
/// This is called when client is aware of proxy
...
...
@@ -278,7 +278,7 @@ namespace Titanium.Web.Proxy
// Now create the request
await
HandleHttpSessionRequest
(
endPoint
,
clientConnection
,
clientStream
,
clientStreamWriter
,
cancellationTokenSource
,
connectHostname
,
connectArgs
?.
WebSession
.
ConnectRequest
);
cancellationTokenSource
,
connectHostname
,
connectArgs
?.
WebSession
.
ConnectRequest
);
}
catch
(
ProxyException
e
)
{
...
...
Titanium.Web.Proxy/Extensions/SslExtensions.cs
View file @
3bf4649c
using
System.Collections.Generic
;
using
System.Diagnostics.CodeAnalysis
;
using
System.Net.Security
;
using
System.Security.Authentication
;
using
System.Security.Cryptography.X509Certificates
;
...
...
@@ -81,6 +82,7 @@ namespace Titanium.Web.Proxy.Extensions
Http2
}
[
SuppressMessage
(
"StyleCop.CSharp.MaintainabilityRules"
,
"SA1402:FileMayOnlyContainASingleType"
,
Justification
=
"Reviewed."
)]
internal
class
SslClientAuthenticationOptions
{
internal
bool
AllowRenegotiation
{
get
;
set
;
}
...
...
Titanium.Web.Proxy/Helpers/HttpHelper.cs
View file @
3bf4649c
...
...
@@ -35,7 +35,7 @@ namespace Titanium.Web.Proxy.Helpers
if
(
split
.
Length
==
2
&&
split
[
0
].
Trim
().
EqualsIgnoreCase
(
KnownHeaders
.
ContentTypeCharset
))
{
string
value
=
split
[
1
];
if
(
value
.
Equals
(
"x-user-defined"
,
StringComparison
.
OrdinalIgnoreCase
))
if
(
value
.
Equals
IgnoreCase
(
"x-user-defined"
))
{
continue
;
}
...
...
Titanium.Web.Proxy/Helpers/Network.cs
View file @
3bf4649c
...
...
@@ -21,6 +21,7 @@ namespace Titanium.Web.Proxy.Helpers
// get local IP addresses
var
localIPs
=
Dns
.
GetHostAddresses
(
Dns
.
GetHostName
());
// test if any host IP equals to any local IP or to localhost
return
localIPs
.
Contains
(
address
);
}
...
...
Titanium.Web.Proxy/Helpers/SystemProxy.cs
View file @
3bf4649c
using
System
;
using
System.Diagnostics.CodeAnalysis
;
using
System.Linq
;
using
Microsoft.Win32
;
using
Titanium.Web.Proxy.Models
;
...
...
@@ -6,7 +7,6 @@ using Titanium.Web.Proxy.Models;
// Helper classes for setting system proxy settings
namespace
Titanium.Web.Proxy.Helpers
{
internal
class
HttpSystemProxyValue
{
internal
string
HostName
{
get
;
set
;
}
...
...
@@ -37,6 +37,7 @@ namespace Titanium.Web.Proxy.Helpers
/// <summary>
/// Manage system proxy settings
/// </summary>
[
SuppressMessage
(
"StyleCop.CSharp.MaintainabilityRules"
,
"SA1402:FileMayOnlyContainASingleType"
,
Justification
=
"Reviewed."
)]
internal
class
SystemProxyManager
{
private
const
string
regKeyInternetSettings
=
"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"
;
...
...
Titanium.Web.Proxy/Http/HttpWebClient.cs
View file @
3bf4649c
...
...
@@ -93,8 +93,7 @@ namespace Titanium.Web.Proxy.Http
await
writer
.
WriteLineAsync
(
Request
.
CreateRequestLine
(
Request
.
Method
,
useUpstreamProxy
||
isTransparent
?
Request
.
OriginalUrl
:
Request
.
RequestUri
.
PathAndQuery
,
Request
.
HttpVersion
),
cancellationToken
);
// Send Authentication to Upstream proxy if needed
if
(!
isTransparent
&&
upstreamProxy
!=
null
&&
ServerConnection
.
IsHttps
==
false
...
...
Titanium.Web.Proxy/Http/Request.cs
View file @
3bf4649c
...
...
@@ -212,7 +212,7 @@ namespace Titanium.Web.Proxy.Http
{
string
httpVersion
=
httpCmdSplit
[
2
].
Trim
();
if
(
string
.
Equals
(
httpVersion
,
"HTTP/1.0"
,
StringComparison
.
OrdinalIgnoreCase
))
if
(
httpVersion
.
EqualsIgnoreCase
(
"HTTP/1.0"
))
{
version
=
HttpHeader
.
Version10
;
}
...
...
Titanium.Web.Proxy/Http/RequestResponseBase.cs
View file @
3bf4649c
using
System
;
using
System.ComponentModel
;
using
System.Diagnostics.CodeAnalysis
;
using
System.IO
;
using
System.Text
;
using
Titanium.Web.Proxy.Compression
;
...
...
@@ -14,7 +15,7 @@ namespace Titanium.Web.Proxy.Http
/// <summary>
/// Cached body content as byte array.
/// </summary>
protected
byte
[]
BodyInternal
;
protected
byte
[]
BodyInternal
{
get
;
private
set
;
}
/// <summary>
/// Cached body as string.
...
...
@@ -24,7 +25,7 @@ namespace Titanium.Web.Proxy.Http
/// <summary>
/// Store weather the original request/response has body or not, since the user may change the parameters
/// </summary>
internal
bool
OriginalHasBody
;
internal
bool
OriginalHasBody
{
get
;
set
;
}
/// <summary>
/// Keeps the body data after the session is finished.
...
...
@@ -62,6 +63,7 @@ namespace Titanium.Web.Proxy.Http
return
-
1
;
}
set
{
if
(
value
>=
0
)
...
...
@@ -105,6 +107,7 @@ namespace Titanium.Web.Proxy.Http
string
headerValue
=
Headers
.
GetHeaderValueOrNull
(
KnownHeaders
.
TransferEncoding
);
return
headerValue
!=
null
&&
headerValue
.
ContainsIgnoreCase
(
KnownHeaders
.
TransferEncodingChunked
);
}
set
{
if
(
value
)
...
...
@@ -135,6 +138,7 @@ namespace Titanium.Web.Proxy.Http
EnsureBodyAvailable
();
return
BodyInternal
;
}
internal
set
{
BodyInternal
=
value
;
...
...
Titanium.Web.Proxy/Http/Response.cs
View file @
3bf4649c
...
...
@@ -155,7 +155,7 @@ namespace Titanium.Web.Proxy.Http
string
httpVersion
=
httpResult
[
0
];
version
=
HttpHeader
.
Version11
;
if
(
string
.
Equals
(
httpVersion
,
"HTTP/1.0"
,
StringComparison
.
OrdinalIgnoreCase
))
if
(
httpVersion
.
EqualsIgnoreCase
(
"HTTP/1.0"
))
{
version
=
HttpHeader
.
Version10
;
}
...
...
Titanium.Web.Proxy/Http/Responses/GenericResponse.cs
View file @
3bf4649c
...
...
@@ -3,9 +3,9 @@ using System.Web;
namespace
Titanium.Web.Proxy.Http.Responses
{
///
<summary>
///
Anything other than a 200 or 302 response
///
</summary>
///
<summary>
///
Anything other than a 200 or 302 response
///
</summary>
public
class
GenericResponse
:
Response
{
/// <summary>
...
...
Titanium.Web.Proxy/Http/Responses/RedirectResponse.cs
View file @
3bf4649c
...
...
@@ -8,7 +8,7 @@ namespace Titanium.Web.Proxy.Http.Responses
public
sealed
class
RedirectResponse
:
Response
{
/// <summary>
///
Constructor
.
///
Initializes a new instance of the <see cref="RedirectResponse" /> class
.
/// </summary>
public
RedirectResponse
()
{
...
...
Titanium.Web.Proxy/Network/CertificateManager.cs
View file @
3bf4649c
...
...
@@ -57,9 +57,9 @@ namespace Titanium.Web.Proxy.Network
private
X509Certificate2
rootCertificate
;
private
string
rootCertificateName
;
/// <summary>
/// Initializes a new instance of the <see cref="CertificateManager"/> class.
/// </summary>
/// <param name="rootCertificateName"></param>
/// <param name="rootCertificateIssuerName"></param>
...
...
@@ -241,8 +241,7 @@ namespace Titanium.Web.Proxy.Network
public
void
Dispose
()
{
}
private
string
GetRootCertificateDirectory
()
{
string
assemblyLocation
=
Assembly
.
GetExecutingAssembly
().
Location
;
...
...
@@ -254,7 +253,7 @@ namespace Titanium.Web.Proxy.Network
}
string
path
=
Path
.
GetDirectoryName
(
assemblyLocation
);
if
(
null
==
path
)
if
(
path
==
null
)
{
throw
new
NullReferenceException
();
}
...
...
@@ -322,7 +321,6 @@ namespace Titanium.Web.Proxy.Network
/// </summary>
/// <param name="storeName"></param>
/// <param name="storeLocation"></param>
/// <returns></returns>
private
void
InstallCertificate
(
StoreName
storeName
,
StoreLocation
storeLocation
)
{
if
(
RootCertificate
==
null
)
...
...
@@ -359,7 +357,6 @@ namespace Titanium.Web.Proxy.Network
/// <param name="storeName"></param>
/// <param name="storeLocation"></param>
/// <param name="certificate"></param>
/// <returns></returns>
private
void
UninstallCertificate
(
StoreName
storeName
,
StoreLocation
storeLocation
,
X509Certificate2
certificate
)
{
...
...
@@ -447,9 +444,9 @@ namespace Titanium.Web.Proxy.Network
{
certificate
=
new
X509Certificate2
(
certificatePath
,
string
.
Empty
,
StorageFlag
);
}
// if load failed create again
catch
{
// if load failed create again
certificate
=
MakeCertificate
(
certificateName
,
false
);
}
}
...
...
@@ -532,8 +529,7 @@ namespace Titanium.Web.Proxy.Network
await
Task
.
Delay
(
1000
*
60
);
}
}
/// <summary>
/// Stops the certificate cache clear process
/// </summary>
...
...
@@ -779,8 +775,7 @@ namespace Titanium.Web.Proxy.Network
EnsureRootCertificate
();
}
/// <summary>
/// Determines whether the root certificate is trusted.
/// </summary>
...
...
@@ -866,6 +861,7 @@ namespace Titanium.Web.Proxy.Network
ErrorDialog
=
false
,
WindowStyle
=
ProcessWindowStyle
.
Hidden
},
// currentUser\Personal & currentMachine\Personal
new
ProcessStartInfo
{
...
...
Titanium.Web.Proxy/Network/WinAuth/Security/Message.cs
View file @
3bf4649c
...
...
@@ -65,8 +65,6 @@ namespace Titanium.Web.Proxy.Network.WinAuth.Security
// methods
private
void
Decode
(
byte
[]
message
)
{
//base.Decode (message);
if
(
message
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
message
));
...
...
Titanium.Web.Proxy/Network/WinAuth/Security/WinAuthEndPoint.cs
View file @
3bf4649c
...
...
@@ -18,8 +18,7 @@ namespace Titanium.Web.Proxy.Network.WinAuth.Security
/// Keep track of auth states for reuse in final challenge response
/// </summary>
private
static
readonly
IDictionary
<
Guid
,
State
>
authStates
=
new
ConcurrentDictionary
<
Guid
,
State
>();
/// <summary>
/// Acquire the intial client token to send
/// </summary>
...
...
@@ -68,8 +67,7 @@ namespace Titanium.Web.Proxy.Network.WinAuth.Security
out
clientToken
,
out
NewContextAttributes
,
out
NewLifeTime
);
if
(
result
!=
IntermediateResult
)
{
return
null
;
...
...
@@ -122,8 +120,7 @@ namespace Titanium.Web.Proxy.Network.WinAuth.Security
out
clientToken
,
out
NewContextAttributes
,
out
NewLifeTime
);
if
(
result
!=
SuccessfulResult
)
{
return
null
;
...
...
@@ -173,18 +170,16 @@ namespace Titanium.Web.Proxy.Network.WinAuth.Security
if
(
expectedAuthState
==
State
.
WinAuthState
.
UNAUTHORIZED
)
{
return
stateExists
==
false
||
return
!
stateExists
||
state
.
AuthState
==
State
.
WinAuthState
.
UNAUTHORIZED
||
state
.
AuthState
==
State
.
WinAuthState
.
AUTHORIZED
;
// Server may require re-authentication on an open connection
state
.
AuthState
==
State
.
WinAuthState
.
AUTHORIZED
;
// Server may require re-authentication on an open connection
}
if
(
expectedAuthState
==
State
.
WinAuthState
.
INITIAL_TOKEN
)
{
return
stateExists
&&
(
state
.
AuthState
==
State
.
WinAuthState
.
INITIAL_TOKEN
||
state
.
AuthState
==
State
.
WinAuthState
.
AUTHORIZED
);
// Server may require re-authentication on an open connection
state
.
AuthState
==
State
.
WinAuthState
.
AUTHORIZED
);
// Server may require re-authentication on an open connection
}
throw
new
Exception
(
"Unsupported validation of WinAuthState"
);
...
...
Titanium.Web.Proxy/Network/WinAuth/WinAuthHandler.cs
View file @
3bf4649c
...
...
@@ -23,8 +23,7 @@ namespace Titanium.Web.Proxy.Network.WinAuth
var
tokenBytes
=
WinAuthEndPoint
.
AcquireInitialSecurityToken
(
serverHostname
,
authScheme
,
requestId
);
return
string
.
Concat
(
" "
,
Convert
.
ToBase64String
(
tokenBytes
));
}
/// <summary>
/// Get the final token given the server challenge token
/// </summary>
...
...
Titanium.Web.Proxy/ProxyServer.cs
View file @
3bf4649c
...
...
@@ -9,6 +9,7 @@ using System.Threading;
using
System.Threading.Tasks
;
using
StreamExtended.Network
;
using
Titanium.Web.Proxy.EventArguments
;
using
Titanium.Web.Proxy.Extensions
;
using
Titanium.Web.Proxy.Helpers
;
using
Titanium.Web.Proxy.Helpers.WinHttp
;
using
Titanium.Web.Proxy.Models
;
...
...
@@ -25,7 +26,7 @@ namespace Titanium.Web.Proxy
public
partial
class
ProxyServer
:
IDisposable
{
/// <summary>
/// HTTP & HTTPS scheme shorthands.
/// HTTP &
amp;
HTTPS scheme shorthands.
/// </summary>
internal
static
readonly
string
UriSchemeHttp
=
Uri
.
UriSchemeHttp
;
...
...
@@ -170,8 +171,7 @@ namespace Titanium.Web.Proxy
/// Realm used during Proxy Basic Authentication.
/// </summary>
public
string
ProxyRealm
{
get
;
set
;
}
=
"TitaniumProxy"
;
/// <summary>
/// List of supported Ssl versions.
/// </summary>
...
...
@@ -181,7 +181,6 @@ namespace Titanium.Web.Proxy
#endif
SslProtocols
.
Tls
|
SslProtocols
.
Tls11
|
SslProtocols
.
Tls12
;
/// <summary>
/// Manages certificates used by this proxy.
/// </summary>
...
...
@@ -483,7 +482,7 @@ namespace Titanium.Web.Proxy
foreach
(
var
proxy
in
proxyInfo
.
Proxies
.
Values
)
{
if
((
proxy
.
HostName
==
"127.0.0.1"
||
proxy
.
HostName
.
Equals
(
"localhost"
,
StringComparison
.
OrdinalIgnoreCase
))
||
proxy
.
HostName
.
Equals
IgnoreCase
(
"localhost"
))
&&
ProxyEndPoints
.
Any
(
x
=>
x
.
Port
==
proxy
.
Port
))
{
protocolToRemove
|=
proxy
.
ProtocolType
;
...
...
Titanium.Web.Proxy/RequestHandler.cs
View file @
3bf4649c
...
...
@@ -17,7 +17,7 @@ namespace Titanium.Web.Proxy
/// <summary>
/// Handle the request
/// </summary>
partial
class
ProxyServer
p
ublic
p
artial
class
ProxyServer
{
private
static
readonly
Regex
uriSchemeRegex
=
new
Regex
(
"^[a-z]*://"
,
RegexOptions
.
IgnoreCase
|
RegexOptions
.
Compiled
);
...
...
@@ -40,8 +40,6 @@ namespace Titanium.Web.Proxy
/// explicit endpoint.
/// </param>
/// <param name="connectRequest">The Connect request if this is a HTTPS request from explicit endpoint.</param>
/// <param name="isTransparentEndPoint">Is this a request from transparent endpoint?</param>
/// <returns></returns>
private
async
Task
HandleHttpSessionRequest
(
ProxyEndPoint
endPoint
,
TcpClientConnection
clientConnection
,
CustomBufferedStream
clientStream
,
HttpResponseWriter
clientStreamWriter
,
CancellationTokenSource
cancellationTokenSource
,
string
httpsConnectHostname
,
ConnectRequest
connectRequest
)
...
...
@@ -171,10 +169,9 @@ namespace Titanium.Web.Proxy
// create a new connection if hostname/upstream end point changes
if
(
serverConnection
!=
null
&&
(!
serverConnection
.
HostName
.
Equals
(
request
.
RequestUri
.
Host
,
StringComparison
.
OrdinalIgnoreCase
)
||
args
.
WebSession
.
UpStreamEndPoint
!=
null
&&
!
args
.
WebSession
.
UpStreamEndPoint
.
Equals
(
serverConnection
.
UpStreamEndPoint
)))
&&
(!
serverConnection
.
HostName
.
EqualsIgnoreCase
(
request
.
RequestUri
.
Host
)
||
args
.
WebSession
.
UpStreamEndPoint
?.
Equals
(
serverConnection
.
UpStreamEndPoint
)
==
false
))
{
serverConnection
.
Dispose
();
serverConnection
=
null
;
...
...
Titanium.Web.Proxy/ResponseHandler.cs
View file @
3bf4649c
...
...
@@ -11,7 +11,7 @@ namespace Titanium.Web.Proxy
/// <summary>
/// Handle the response from server.
/// </summary>
partial
class
ProxyServer
p
ublic
p
artial
class
ProxyServer
{
/// <summary>
/// Called asynchronously when a request was successfully and we received the response.
...
...
@@ -23,6 +23,7 @@ namespace Titanium.Web.Proxy
try
{
var
cancellationToken
=
args
.
CancellationTokenSource
.
Token
;
// read response & headers from server
await
args
.
WebSession
.
ReceiveResponse
(
cancellationToken
);
...
...
Titanium.Web.Proxy/Settings.StyleCop
0 → 100644
View file @
3bf4649c
<StyleCopSettings Version="105">
<Analyzers>
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
<Rules>
<Rule Name="FileMustHaveHeader">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParameterDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementReturnValueMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementReturnValueDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PropertySummaryDocumentationMustMatchAccessors">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ConstructorSummaryDocumentationMustBeginWithStandardText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="EnumerationItemsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationTextMustContainWhitespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustShowCopyright">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParametersMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PartialElementsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.ReadabilityRules">
<Rules>
<Rule Name="PrefixLocalCallsWithThis">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParameterMustFollowComma">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SplitParametersMustStartOnLineAfterDeclaration">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParametersMustBeOnSameLineOrSeparateLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PrefixCallsCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.NamingRules">
<Rules>
<Rule Name="ElementMustBeginWithUpperCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StaticReadonlyFieldsMustBeginWithUpperCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ConstFieldNamesMustBeginWithUpperCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldNamesMustNotUseHungarianNotation">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldNamesMustBeginWithLowerCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.OrderingRules">
<Rules>
<Rule Name="UsingDirectivesMustBePlacedWithinNamespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementsMustBeOrderedByAccess">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StaticElementsMustAppearBeforeInstanceElements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementsMustAppearInTheCorrectOrder">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ConstantsMustAppearBeforeFields">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
</Analyzers>
</StyleCopSettings>
\ No newline at end of file
Titanium.Web.Proxy/TransparentClientHandler.cs
View file @
3bf4649c
...
...
@@ -17,7 +17,7 @@ using Titanium.Web.Proxy.Network.Tcp;
namespace
Titanium.Web.Proxy
{
partial
class
ProxyServer
p
ublic
p
artial
class
ProxyServer
{
/// <summary>
/// This is called when this proxy acts as a reverse proxy (like a real http server).
...
...
@@ -115,7 +115,7 @@ namespace Titanium.Web.Proxy
}
}
//var serverHelloInfo = await SslTools.PeekServerHello(serverStream);
//
//
var serverHelloInfo = await SslTools.PeekServerHello(serverStream);
await
TcpHelper
.
SendRaw
(
clientStream
,
serverStream
,
BufferSize
,
null
,
null
,
cancellationTokenSource
,
ExceptionFunc
);
...
...
Titanium.Web.Proxy/WinAuthHandler.cs
View file @
3bf4649c
...
...
@@ -124,9 +124,10 @@ namespace Titanium.Web.Proxy
request
.
ContentLength
=
0
;
}
}
// challenge value will start with any of the scheme selected
else
{
// challenge value will start with any of the scheme selected
scheme
=
authSchemes
.
First
(
x
=>
authHeader
.
Value
.
StartsWith
(
x
,
StringComparison
.
OrdinalIgnoreCase
)
&&
authHeader
.
Value
.
Length
>
x
.
Length
+
1
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment