This is an odd one. I am running bitcoind 0.9.1 on Ubuntu 14.04 and have this behaviour:
Doesn't work:
$ bitcoind getinfo
error: couldn't connect to server
(timeout after 30s)
Works fine:
$ curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }' -H 'content-type: text/plain;' http://user:pass@localhost:8332/
{"result":{"version":90100,"protocolversion":70002,"walletversion":60000,"balance":0.00000000,"blocks":311140,"timeoffset":0,"connections":13,"proxy":"","difficulty":17336316978.50783157,"testnet":false,"keypoololdest":1402698503,"keypoolsize":102,"paytxfee":0.00000000,"errors":""},"error":null,"id":"curltest"}
Question:
Why does the bitcoind CLI not connect to the server, but curl does?
Driving me nuts. Something buggy in 0.9.1's JSON-RPC client implementation?