I am testing some Bamboo APIs with the goal of writing a report requested by management. I am using cURL until I figure out what works and then will probably move to Ansible.
In all responses I get a string "* Connection #0 bamboo.<companyname>.com left intact." Usually, this is the last line before the json formatted payload and causes no problems. But if the response is long, the string may get inserted into the middle of the json payload resulting in broken json.
Here is an example snippet (I added the bold)
. . . "plan":{"shortName":"Mod of HelloWorld","shortKey":"MH","type":"chain","enabled":true,"link":{"href":"https://bamboo.dev<companyname>com/rest/api/latest/plan/TABVTJP* Connection #0 to host bamboo.dev.<companyname>.com left intact
-MH","rel":"self"},"key":"TABXXJP-YY","name":"Test availability of BITBUCKET_BRANCH variable to java program - Mod of HelloWorld","planKey":{"key":"TABXXJP-YY"}}, . . .
Does anyone have any suggestions?
Hello @james_mckean
Adding a header "Connection: close" to your cURL command line should solve the problem:
curl -v -H "Connection: close" https://bamboo.dev.<companyname>.com
From this page:
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.
Regards,
Eduardo Alvarenga
Atlassian Support APAC
Hmm. Not exactly. Now it drops the "closing connection " notification into the json response, again breaking the json.
BSR-PLAN"}},{"shortName":"build the specs demo plan","shortKey":"SDP","type":"chain","enabled* Closing connection 1
* TLSv1.2 (OUT), TLS alert, close notify (256):
":false,"link":{"href":"https://bamboo.dev.companyName.com/rest/api/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @james_mckean
That message comes from the SSL library that cURL is linked to (usually OpenSSL/LibreSSL) and will show up when using curl with a "-v" flag. Those messages are sent to the standard error output and can be discarded by your script.
Try running it without the "-v" flag.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.