-
Notifications
You must be signed in to change notification settings - Fork 642
Let introduce the request state to keep it between events and simplify error logging. #690
Conversation
Master to beta
Master to beta
do not throw exception in fillbuffer (only when it called on an alrea…
Master to beta
Merge to beta
small fixes and improvements
Support EnableWinAuth per session justcoding121#633
netcoreapp2.1 target removed, use netstandard 2.1
add IsSocketReuseAvailable
enable socket based on framework version via RunTime.IsSocketReuseAvailable
enable socket reuse based on framework via RunTime.IsSocketReuseAvailable
fix compatibility bug
missed one
Enable socket reuse based on framework
better uri handling
missing dependencies added
net4.5 support is back
Another websocket fix
There is already a SessionEventArgs class, it contains the state of the request. I think it is unnecessary to add another object. There are too many garbage in this PR, for example Titanium.Web.Proxy.Examples.Wpf_lmb5j4or_wpftmp.csproj file. It looks a temporary file. Why did you rename the ProxyServer class to ProxyServer base? What do you want to achive exaclty? |
💥 🏃 👀 |
SessionEventArgs is not extensible by custom state. Moreover SessionEventArgs is too late. I need to share state between all pipeline events, i.e. including ServerCertificateValidationCallback; and of course I need to have access to my (custom, extended) state in error handler on any pipeline stage including socket internal errors. Yes, I have renamed old ProxyServer class to ProxyServer base to minimize changes in code. You can see at basic sample that all that you need to implement custom state is to inherit from base request state and all other things became work fine.
Please compile and debug Titanium.Web.Proxy.Examples.Basic sample at master branch in my fork. I would make much more refactoring to simplify API but now I prefer to have code compatibility and simple merges with base repo. |
There is a UserData property in the SessionEventArgs(Base) class. You can set any custom state in that. SessionEventArgs was already there in: It was just added to I can add the user data to OnClientConnectionCreate event if needed. OnServerConnectionCreate is not really related to a single session, since the connections are re-used for new client connections, however it could receive the first user data. I'm sorry, but currently I can't merge this PR. Please try to create a new one only with your changes. And also please create a clean PR:
|
No problem. |
… not for each request) Similar to PR #690
User state in ProxyEventArgsBase? May be it solve my critical needs rigth now. But what about socket errors? Before client connection is established? How to diagnose it? I will try to show how to do it in my fork. You are welcome to merge my code any time. |
How would you have a socket error before a client makes a request? A listener error? |
A listen error can be catched when you call the ProxyServer.Start() method (Or the ProxyServer.AddEndPoint(), while the server is already running) But I think there is no related changes for this in your fork. Now the only differnece that I see is that you have an OnError method, which is only called when there is an exception in the User code of the ServerCertificateValidationCallback. It is a good idea to add a non-global error handler to the request. I'll add it to the ProxyBaseEventArgs, so you will be able to subscribe for the errors of a single request. I plan to add an IsHandled property to the event arguments and when it is not true, the global error handler will be called (as it is now). And of course it should be fired for user calback errors and non user errors, too. I appreciate your work, but next time if you create a PR, please be careful and do not overwrite other changes and do not reformat the code (using tabs), only when the purpuse of the PR is the code cleanup. |
OK |
Next time I will try to foollow code formatting of the source of TWP. But you need to merge your beta and stable branches to master. |
See basic sample
Doneness: