I'm trying to build ktor from scratch (I'm interes...
# ktor
j
I'm trying to build ktor from scratch (I'm interested in native curl, I need to customize the libcurl client) but tests are failing, is this known?
Copy code
[ RUN      ] io.ktor.client.test.CurlEnginesTest.postTest
kotlin.AssertionError: Expected <HttpBinResponse(url=<http://httpbin.org/post>, args={}, headers={Content-Type=text/plain; charset=UTF-8, Accept=application/json, Content-Length=11, Connection=close, Host=<http://httpbin.org|httpbin.org>})>, actual <HttpBinResponse(url=<http://httpbin.org/post>, args={}, headers={Accept=application/json, Connection=close, Content-Length=11, Content-Type=text/plain; charset=UTF-8, Host=<http://httpbin.org|httpbin.org>, X-Imforwards=20})>.
e
Hi @jdiaz, the
CURL
engine is available in ktor
1.1.2
Probably it’s the curl version issue, could you provide the OS and CURL versions to figure it out?
j
@e5l curl 7.43.0 (x86_64-apple-darwin15.0.0) libcurl/7.43.0 SecureTransport zlib/1.2.5
I know curl engine is available, I made it work but there's not enough customization as I need to provide some other parameters to libcurl
e
We test it with 7.63
j
Same thing with: curl 7.63.0 (x86_64-apple-darwin15.6.0) libcurl/7.63.0 SecureTransport zlib/1.2.5 libidn2/2.0.5
Copy code
➜  ktor git:(master) where curl
/usr/local/opt/curl/bin/curl
e
Anyway, it looks like the
HttpBin
provides the additional header and this test should be changed.
What do you want to customize in Curl? Probably we should introduce the extension point in configuration.
j
This would be more or less what I'd need
Copy code
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, file)
curl_easy_setopt(curl, CURLOPT_UNRESTRICTED_AUTH, 1L)
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L)
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, auth)
curl_easy_setopt(curl, CURLOPT_USERPWD, user)
Maybe a function that you can handle in a low level way the curl object and some extension functions to make that easier