Commit graph

20 commits

Author SHA1 Message Date
Tomás Senart 77fdb1011b Handle non successfull HTTP responses
This change set equips the RPC client with handling of non successful
HTTP responses. An HTTP response is considered non successful when its
status code is not in the range 200..299
2014-07-03 18:54:50 +02:00
Dave Collins 0e463baf95 goimports -w . 2014-07-02 19:34:05 -05:00
Dave Collins a9e1b8fb84 Use system CAs when Certificates are not specified.
This commit modifies the TLS setup to only override the RootCAs for the
TLS connection if certificates are specified.  This allows the
Certificates parameter to be ommitted from the connection config to use
the system CAs.
2014-06-25 21:53:00 -05:00
David Hill 0ae3676a7d Log when the initial connection has been made. 2014-06-25 12:56:47 -04:00
Josh Rickmar 22b6af1400 Fix unmarshaling of HTTP POST responses.
If connecting to a bitcoin RPC server as an HTTP POST client, full
response objects rather than just the raw result bytes were being
passed to the specific result unmarshalers, causing unmarshal errors
for the incorrect JSON types.  To fix this, first unmarshal the
response body into a rawResponse, and pass only the raw result bytes
(or an error) to the specific handlers.

This was reported by nskelsey on IRC.

ok @davecgh
2014-06-18 10:21:18 -05:00
Dave Collins 7448f9555c Make golint happier. 2014-06-12 23:00:03 -05:00
Josh Rickmar 28c0a3c8c7 Modify doco and example for btcwallet ws endpoint. 2014-06-12 13:00:42 -05:00
Josh Rickmar 4ac778d72a Do not reissue rescan requests on reconnect. 2014-06-12 11:38:22 -05:00
Josh Rickmar 1ec6dde39c Add custom/raw request/response support. 2014-06-11 16:38:54 -05:00
Josh Rickmar 793e66c785 Add callback for connects and reconnects. 2014-06-11 16:38:54 -05:00
Dave Collins 8e624b20a9 Switch to conformal vendoring of Gorilla websocket. 2014-06-07 01:06:11 -05:00
kargakis a785ef6424 minor syntax fixes 2014-06-02 17:31:02 +03:00
Dave Collins a35c1e8ede Auto recreate notification state on reconnect.
This commit adds logic to track all registered notifications that have
been registered by the client in a notification state when the default
automatic reconnect is enabled.

The notification state is then used to reregister for all previously
registered notifications on reconnect.  This allows the caller to
continue receiving notifications across reconnect cycles.
2014-05-10 02:15:09 -05:00
Dave Collins 8700eeaeb6 Convert to use gorilla websockets package.
Also, since the new package exposes more connection related error
information, add a new ErrInvalidEndpoint which is returned if the
specified enpoint does not appear to be a valid websocket provider and
only return the ErrInvalidAuth error when HTTP authorization failure
status codes are detected.

Closes #1.
2014-05-09 19:57:58 -05:00
Dave Collins 2fc983ece1 Finish the comment on the Disconnect function. 2014-05-08 13:10:09 -05:00
Dave Collins 6825e68c59 Use uint64 for the request ID instead of int64.
There is no reason for the request ID to be signed.  Pointed out by
@jrick.
2014-05-08 13:05:31 -05:00
Dave Collins 7c552136bc Move Disconnected next to Disconnect func. 2014-05-07 11:23:35 -05:00
Dave Collins 1122a8a9cb Remove leftover testing sleep. 2014-05-07 11:23:27 -05:00
Dave Collins cf409a8d79 Disconnect client on shutdown. 2014-05-07 11:19:30 -05:00
Dave Collins e3f130ade5 Initial commit. 2014-05-07 11:14:39 -05:00