https://kotlinlang.org logo
#ktor
Title
# ktor
m

melatonina

05/08/2021, 9:51 AM
Hello. When I use ktor client to check my IP with any public API, the services close the connection. I can use all those services with with the browser or curl. Why is this happening?
Copy code
client.get<String>("<https://api.ipify.org>")
yields
java.io.IOException: Broken pipe
while
Copy code
client.get("<https://ktor.io/>")
works just fine.
Copy code
client.get<String>("<http://curlmyip.org/>")
causes
org.eclipse.jetty.io.EofException
I'm even impersonating curl:
Copy code
val client = HttpClient(Jetty) {
    CurlUserAgent()
}
a

Aleksei Tirman [JB]

05/12/2021, 9:35 AM
That's because those endpoints don't support HTTP/2 (try
curl --http2-prior-knowledge <https://api.ipify.org>
). Just use engine that supports HTTP/1.1, e.g.
Apache
.
👍 1
m

melatonina

08/03/2021, 9:50 AM
Sorry, I didn't see your reply earlier. Thanks!
5 Views