-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow selecting a custom HTTP engine for Kord (niche request!) #69
Comments
Hello, and thanks for opening an issue! As this is the first time you've created an issue on this repository, we'd just like to offer you a warm welcome to the project, and the following pointers:
|
If Kord provides something for this, then I suspect it should be pretty easy to expose that, right? Can't imagine this being difficult. |
Kord allows setting |
Yeah that's what I did with the workaround. If I can do that with Kordex without duplicating a lot of code that would be good Side note |
Instead of providing a direct abstraction for this, I'm adding a This will be available in the next snapshot, but I'm hoping to get a release out soon! Also: Nice. |
Summary
Currently I have a (very) niche problem whenever I want to test or run my bot -- turns out that Kord defaults to use CIO for its default HTTP engine for Ktor, which has some bizarre issues with my proxy service that made the outward packets not handled by the proxy service. After some research I found out that my proxy is running under SOCKS, while CIO and Apache engines only support HTTP proxies for some godforsaken reasons.
After some more research I found out that Ktor also supports the Java HTTP Client, which fully supports SOCKS proxies and after using some (concerning) hacks I was able to get it to work.
Current Behaviour
The HTTP client is hardwired to use CIO, which is undesirable for my needs as mentioned above.
Preferred Behaviour
Allow a field to be exposed in
ExtensionBotBuilder
, either of typeHttpClient
orHttpClientEngineFactory<*>
to set customize the HTTP client or its engine. The latter may require modifying Ktor, but from what I can see, modifyingHttpClient
is perfectly acceptable within Ktor's APIs, as aKordBuilder
can be specified to take a custom client, while all of the normal settings required to make it work still applies.Suggestions
I noticed that only a selection of settings are customizable in
ExtensionBotBuilder
, presumably due to encapsulation concerns. But in addition to the ability to customize HTTP clients (which is arguably niche), I don't see why theKordBuilder
cannot be customized with a configure function (likeKordBuilder.() -> Unit
). That would solve the entire problem, and may even prevent future problems like this showing up.Media
Current workaround
Current workaround for this issue; some parts are redacted and/or deletedThe text was updated successfully, but these errors were encountered: