Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does "* Connection #0 to host example.com left intact" mean?

Tags:

curl

I'm using curl with curl -v https://example.com

and at the end it says * Connection #0 to host example.com left intact. What does that mean?

like image 412
cooldude101 Avatar asked May 18 '20 23:05

cooldude101


People also ask

What does it mean to make a connection?

Definition of make a/the connection : to understand that there is a relationship between two or more things It didn't take long for us to make the connection between the missing money and our partner's new car.

What does connection to a person mean?

Human connection is a deep bond that's formed between people when they feel seen and valued. During an authentic human connection, people exchange positive energy with one another and build trust. Human connection makes you feel heard and understood and gives you a sense of belonging.

What is the meaning of in connection?

Definition of in connection with : in relation to (something) : for reasons that relate to (something) —used especially in journalism Police arrested four men in connection with the robbery.

What does root connection mean?

The root is the Latin connexionem, "a binding or joining together." Definitions of connection.


2 Answers

Adding a header "Connection: close" to your CURL command should solve the problem:

curl -v -H "Connection: close" https://example.com

Explanation can be found in this article:

Why is the connection left intact ?

The connection is left intact, because the server allowed it to stay open and CURL no need to close it after you receive the response for the request sent. That’s why the requests return ‘Connection: keep-alive‘ headers when you expect ‘Connection:close‘

If you wanted to close the connection, then you could send CURL request with ‘Connection: close‘ as shown below and you could see ‘* Closing connection 0‘ in the response.

I hope the article https://www.sneppets.com/software/connection-0-to-host-localhost-left-intact/ helps you solve your problem.

like image 82
Martin Ille Avatar answered Oct 08 '22 02:10

Martin Ille


Short answer: it doesn't mean anything, when you just request one URL. After curl is finished and the process exits, the connection is not left intact anywhere despite the misleading message; it is closed just like you'd expect.

The connection is only reused if you fetch multiple URLs in the same curl invocation. In that case it's a good thing, and you shouldn't need to force the connection to close, unless you're debugging connection issues.

(I too went looking for answers, when I wanted to check that curl doesn't somehow keep the connection open in the background of my shell. It doesn't.)

like image 43
Rennex Avatar answered Oct 08 '22 00:10

Rennex