bchavez / Coinbase

:moneybag: A .NET/C# implementation of the Coinbase API.
https://developers.coinbase.com/api/v2
MIT License
170 stars 92 forks source link

Suggestion to add a way to disable Fiddler proxy #63

Closed astrohart closed 5 years ago

astrohart commented 5 years ago

Context

Sometimes I want to debug my bot by utilizing Fiddler to look at the HTTP proxy. My bot runs as a Windows Service. I detect if Fiddler.EXE process is running in my service, and if so, enable the proxy automatically.

API calls sometimes won't work if Fiddler proxy is enabled but then the Fiddler.EXE is closed. I want to be able to open and close the Fiddler.EXE GUI and have my service be able to detect this on the fly, and enable/disable the Fiddler proxy dynamically. It may be the case that I get done debugging and I want to then close the Fiddler GUI (since it IS decrypting my HTTPS traffic, after all!).

My concern is, after I'm done debugging with Fiddler but I want to keep my bot running, the bot will fail in its next API call because Fiddler is enabled on the CoinbaseClient (via a call to the CoinbaseClient.EnableFiddlerProxy method) but the Fiddler.EXE is not running.

My suggestion is to make a property FiddlerProxyEnabled (of type bool) and/or make a DisableFiddlerProxy method.

Alternatives

Of course, when I close Fiddler, I can always go in and restart my service via the Services control panel. Then it will detect that the Fiddler.EXE has been closed. However, this is a pain.

Has the feature been requested before?

Not to my knowledge.

If the feature request is approved, would you be willing to submit a PR?

Yes

bchavez commented 5 years ago

Hi Brian,

I appreciate your scenario; however, Fiddler debugging supported by this Coinbase library is meant for test and debug environments, not dynamic debugging scenarios.

If you want dynamic traffic debugging, you'll need to enable it and implement it in your own project. That can easily be done by implementing a C# extension method over CoinbaseClient that reverses the following process:

https://github.com/bchavez/Coinbase/blob/3559fb88d4545f87074aad21df528e44790c2842/Source/Coinbase/CoinbaseClient.cs#L91-L105

Probably by setting the DefaultHttpClientFactory back in Flurl:

this.Configure(settings => 
    { 
       settings.HttpClientFactory = new DefaultHttpClientFactory();
    }); 

Thanks, Brian

astrohart commented 5 years ago

Funny, I’ve tried that, and it does not work. Oh well, I guess I will have to make do. Thanks.

Regards,

Brian

On Sep 1, 2019, at 9:30 PM, Brian Chavez notifications@github.com wrote:

Hi Brian,

I appreciate your scenario; however, Fiddler debugging supported by this Coinbase library is meant for test and debug environments, not dynamic debugging scenarios.

If you want dynamic traffic debugging, you'll need to enable it and implement it in your own project. That can easily be done by implementing a C# extension method over CoinbaseClient that reverses the following process:

https://github.com/bchavez/Coinbase/blob/3559fb88d4545f87074aad21df528e44790c2842/Source/Coinbase/CoinbaseClient.cs#L91-L105

Probably by setting the DefaultHttpClientFactory back in Flurl:

this.Configure(settings => { settings.HttpClientFactory = new DefaultHttpClientFactory(); }); Thanks, Brian

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.