-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Support native windows HTTP client #671
Comments
The sample kotlin native application which provides WinHTTP-based client is available here: https://github.com/dtretyakov/kotlin-winhttp Currently it has the following problems:
|
Kotlinx I/O supports string constructor |
I believe it's ok to have winhttp cinterop in the client |
To get it work with coroutines a set of hacks need to be applied: currently coroutines only work in the main thread so you need to send signals from a callback thread. The other issue is that there is no main loop implemented on Windows so it's not clear who can listen to such signals. |
@dtretyakov Does winhttp support streaming for request and response body? |
@cy6erGn0m, WinHTTP async read/write operations are based on request -> callback response style of invocation: https://msdn.microsoft.com/en-us/library/windows/desktop/aa383138%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396#art_winhttpheaders So it looks like e.g. the response body could be consumed as a stream while invoking series of:
until |
Note that we are going to introduce curl client, see #777 |
Merged in |
Why was closed? |
It allows to make streaming while writing request and response body. Issue ktorio#671
@cy6erGn0m, @e5l I've added preliminary PR to support WinHTTP-based client: #957 |
It allows to make streaming while writing request and response body. Issue ktorio#671
* Add windows platform for gradle modules * Add WinHTTP support for HTTP client Issue #671 * Use futures in WinHTTP-based client It allows to make streaming while writing request and response body. Issue #671 * Add synchronous working mode for WinHTTP-based client Issue #671 * Extract response header processing * Remove debug logging in WinHTTP-based asynchronous callbacks * Allows to use HTTP/2.0 protocol in WinHTTP-based client Issue #671 * Allows to specify security protocols in WinHTTP-based client Issue #671 * Improve error handling for WinHTTP function calls Issue #671
* Add windows platform for gradle modules * Add WinHTTP support for HTTP client Issue #671 * Use futures in WinHTTP-based client It allows to make streaming while writing request and response body. Issue #671 * Add synchronous working mode for WinHTTP-based client Issue #671 * Extract response header processing * Remove debug logging in WinHTTP-based asynchronous callbacks * Allows to use HTTP/2.0 protocol in WinHTTP-based client Issue #671 * Allows to specify security protocols in WinHTTP-based client Issue #671 * Improve error handling for WinHTTP function calls Issue #671
* Add windows platform for gradle modules * Add WinHTTP support for HTTP client Issue #671 * Use futures in WinHTTP-based client It allows to make streaming while writing request and response body. Issue #671 * Add synchronous working mode for WinHTTP-based client Issue #671 * Extract response header processing * Remove debug logging in WinHTTP-based asynchronous callbacks * Allows to use HTTP/2.0 protocol in WinHTTP-based client Issue #671 * Allows to specify security protocols in WinHTTP-based client Issue #671 * Improve error handling for WinHTTP function calls Issue #671
* Add windows platform for gradle modules * Add WinHTTP support for HTTP client Issue #671 * Use futures in WinHTTP-based client It allows to make streaming while writing request and response body. Issue #671 * Add synchronous working mode for WinHTTP-based client Issue #671 * Extract response header processing * Remove debug logging in WinHTTP-based asynchronous callbacks * Allows to use HTTP/2.0 protocol in WinHTTP-based client Issue #671 * Allows to specify security protocols in WinHTTP-based client Issue #671 * Improve error handling for WinHTTP function calls Issue #671
Is the WinHTTP client going to be released soon or has it been indefinitely put aside? |
Just to clarify: There is currently no ktor client available for windows, correct? |
CURL client engine supports Windows. |
That's interesting, since if I include both required imports:
I can still not import io.ktor.* Is there anything else I need to take into consideration? |
Does not support |
@msink https works for me |
@PatrickLemke - it works in debug mode, but I failed to make distribution package. |
@msink I haven't tried that yet. Are you referring to the difficulty of installing msys on the client system? I was thinking to use an installer like NSIS to install it manually. |
If I remember correctly - it works only if .exe was copied to msys2 bin/ directory, and runned from here. Something like as Git for Windows is distributed. |
Well I guess you could also copy all the libraries you need into your own folder. The only thing that should matter is that mysys has access to all the libraries it needs. |
Not exactly - it looks for ssl certificates in directory relative to .exe - ../ssl , so .exe should be in subdirectory, for example bin/ |
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks. |
* Add windows platform for gradle modules * Add WinHTTP support for HTTP client Issue ktorio#671 * Use futures in WinHTTP-based client It allows to make streaming while writing request and response body. Issue ktorio#671 * Add synchronous working mode for WinHTTP-based client Issue ktorio#671 * Extract response header processing * Remove debug logging in WinHTTP-based asynchronous callbacks * Allows to use HTTP/2.0 protocol in WinHTTP-based client Issue ktorio#671 * Allows to specify security protocols in WinHTTP-based client Issue ktorio#671 * Improve error handling for WinHTTP function calls Issue ktorio#671
* Add windows platform for gradle modules * Add WinHTTP support for HTTP client Issue ktorio#671 * Use futures in WinHTTP-based client It allows to make streaming while writing request and response body. Issue ktorio#671 * Add synchronous working mode for WinHTTP-based client Issue ktorio#671 * Extract response header processing * Remove debug logging in WinHTTP-based asynchronous callbacks * Allows to use HTTP/2.0 protocol in WinHTTP-based client Issue ktorio#671 * Allows to specify security protocols in WinHTTP-based client Issue ktorio#671 * Improve error handling for WinHTTP function calls Issue ktorio#671
To create native windows applications could be useful to have native HTTP client which supports using Windows certificates store for SSL connections, proxy settings configuration on the system level, etc.
Microsoft recommends using WinHTTP for server-side applications and services. WinHTTP is used in .NET windows http client so it's a good candidate to use it on Windows. WinHTTP could work in sync and async mode, which is recommended to use and async calls could be wrapped by using Kotlin coroutines.
The text was updated successfully, but these errors were encountered: