copied from github.com/mpl/scgiclient/example/rtorrent.go