connection left intact

WSO2 Connection #0 to host localhost left intact

After creating and deploying your micro services using WSO2 MSF4J, when you send API requests (formed as per URI-Template defined while creating endpoint) using REST client like curl, you might see following API response “Connection #0 to host localhost left intact

C:\curl-7.47.1\bin>curl -v http://localhost:9090/healthcare/cardiology

*   Trying ::1...
* Connected to localhost (::1) port 9090 (#0)
> GET /healthcare/cardiology HTTP/1.1
> Host: localhost:9090
> User-Agent: curl/7.47.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Connection: keep-alive
< Content-Length: 291
< Content-Type: application/json
<
[{"name":"emeline fulton","hospital":"pine valley community hospital","category"
:"cardiology","availability":"8.00 a.m - 10.00 a.m","fee":4000.0},{"name":"jared
 morris","hospital":"willow gardens general hospital","category":"cardiology","a
vailability":"9.00 a.m - 11.00 a.m","fee":10000.0}]

* Connection #0 to host localhost left intact

Note, in the API response you could observe something like “Connection #0 to host 172.28.128.1 left intact ” after the response or between the response

Why the connection is 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.

C:\curl-7.47.1\bin>curl -v -H "Connection: close" http://localhost:8290/healthcare/querydoctor/surgery

*   Trying ::1...
* Connected to localhost (::1) port 8290 (#0)
> GET /healthcare/querydoctor/surgery HTTP/1.1
> Host: localhost:8290
> User-Agent: curl/7.47.1
> Accept: */*
> Connection: close
>
< HTTP/1.1 200 OK
< Content-Type: application/json
< Date: Fri, 01 Mar 2019 10:49:43 GMT
< Transfer-Encoding: chunked
< Connection: close
<
[{"name":"thomas collins","hospital":"grand oak community hospital","category":"
surgery","availability":"9.00 a.m - 11.00 a.m","fee":7000.0},{"name":"anne cleme
nt","hospital":"clemency medical center","category":"surgery","availability":"8.
00 a.m - 10.00 a.m","fee":12000.0},{"name":"seth mears","hospital":"pine valley
community hospital","category":"surgery","availability":"3.00 p.m - 5.00 p.m","f
ee":8000.0}]

* Closing connection 0

Related Posts

Reference

Subscribe
Notify of
guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Matthew
Matthew
1 year ago

Great for HTTP/HTTPS, what about FTP and everything else?

trackback
Rowling
1 year ago

It worked, thanks.