Avoid a resource leak
Some twiddling

 - also accept the obsolete application/json-rpc content type
 - don't quote regular responses
 - don't separate results with newlines
 - instead make sure to print a newline upon receiving EOF