tcoopman

tcoopman

Econnrefused with Mint

I’m getting an %Mint.TransportError{reason: :econnrefused} for a request like this:

➜ curl -v http://localhost:8888
* processing: http://localhost:8888
*   Trying [::1]:8888...
* Connected to localhost (::1) port 8888
> GET / HTTP/1.1
> Host: localhost:8888
> User-Agent: curl/8.2.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Host: localhost:8888
< Date: Mon, 11 Sep 2023 10:24:31 GMT
< Connection: close
< X-Powered-By: PHP/8.2.9
< Content-Type: application/json
<
* Closing connection
{"status":"OK"}

But a similar request like this one works ok:

➜ curl -v http://localhost:5000
* processing: http://localhost:5000
*   Trying [::1]:5000...
* Connected to localhost (::1) port 5000
> GET / HTTP/1.1
> Host: localhost:5000
> User-Agent: curl/8.2.1
> Accept: */*
>
< HTTP/1.1 200 OK
< X-Powered-By: Express
< Content-Type: application/json; charset=utf-8
< Content-Length: 15
< ETag: W/"f-v/Y1JusChTxrQUzPtNAKycooOTA"
< Date: Mon, 11 Sep 2023 10:24:28 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5
<
* Connection #0 to host localhost left intact
{"status":"OK"}

The second example is a standard Express server and the first one php. In the browser, curl, wget both requests work perfectly ok. Only Mint (and thus tools using Mint, like Req and Finch) gives me an error.

I can see that the responses are not exactly the same, but I don’t see why it should fail (content-length is nto a required header, and I’ve tried with setting the charset as well, but it doesn’t change the results)

Marked As Solved

hauleth

hauleth

curl tries to connect via both IPv4 and IPv6 while Mint probably tries only one of these (IPv4) when not asked to use IPv6 explicitly.

Where Next?

Popular in Questions Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement