Hello. When I use ktor client to check my IP with ...
# ktor
m
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
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
Sorry, I didn't see your reply earlier. Thanks!