Closing connection after sending response (cpp-netlib 0.13.0)

53 views
Skip to first unread message

KSL

unread,
Feb 23, 2018, 2:37:56 AM2/23/18
to The C++ Network Library
I have upgraded cpp-netlib from v0.11.0 to 0.13.0 and run into some difficulties.

Previously, when a request was sent to the server, the connection was closed automatically after sending the response. It appears this is not the case anymore and the connection remains open.

Curl output from 0.11.0

curl --X GET http://192.168.0.19:9999/my-app/rest/status/1.0/time

Note: Unnecessary use of -or --request, GET is already inferred.
*  Trying 192.168.0.19...
* TCP_NODELAY set
* Connected to 192.168.0.19 (192.168.0.19) port 9999 (#0)
> GET /my-app/rest/status/1.0/time HTTP/1.1
> Host: 192.168.0.19:9999
> User-Agent: curl/7.54.0
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Content-Length: 30
< Content-Type: text/html
<
The current time is: 06:50:35
* Closing connection 0
Collapse 



Curl output from 0.13.0

curl -v -X GET http://192.168.0.19:9999/my-app/rest/status/1.0/time

Note: Unnecessary use of -X or --request, GET is already inferred.
*   Trying 192.168.0.19...
* TCP_NODELAY set
* Connected to 192.168.0.19 (192.168.0.19) port 9999 (#0)
> GET /my-app/rest/status/1.0/time HTTP/1.1
> Host: 192.168.0.19:9999
> User-Agent: curl/7.54.0
> Accept: */*
>
The current time is: 06:46:54
* Connection #0 to host 192.168.0.19 left intact

I've found a way to close the connection by adding a close connection header to the server response. Is this the correct thing to do or is there a better way?

Adding that header to the request had no effect.

Reply all
Reply to author
Forward
0 new messages