Commit Graph

77 Commits

Author SHA1 Message Date
Jeff Mitchell
0dbbef1ac0 Don't use http.DefaultClient
This strips out http.DefaultClient everywhere I could immediately find
it. Too many things use it and then modify it in incompatible ways.

Fixes #700, I believe.
2015-10-15 17:54:00 -04:00
Jeff Mitchell
c9c8398352 Add 301 redirect checking to the API client.
Vault doesn't generate these, but in some cases Go's internal HTTP
handler does. For instance, during a mount-tune command, finishing the
mount path with / (as in secret/) would cause the final URL path to
contain .../mounts/secret//tune. The double slash would trigger this
behavior in Go's handler and generate a 301. Since Vault generates 307s,
this would cause the client to think that everything was okay when in
fact nothing had happened.
2015-10-09 17:11:31 -04:00
Dejan Golja
71615a172c Increase default timeout to 30s which should allow for any operation
to complete.
2015-10-09 00:53:35 +11:00
Dejan Golja
4ee297408f added a sensible default timeout for the vault client 2015-10-08 18:44:00 +11:00
Jeff Mitchell
81505f5f97 Rather than use http.DefaultClient, which is simply &http.Client{},
create our own. This avoids some potential client race conditions when
they are setting values on the Vault API client while the default client
is being used elsewhere in other goroutines, as was seen in
consul-template.
2015-09-03 13:47:20 -04:00
Jeff Mitchell
4d6ebab007 Change variable name for clarity 2015-09-03 13:38:24 -04:00
Jeff Mitchell
1a2c44d805 Remove redirect handling code that was never being executed (redirects are manually handled within RawRequest). Add a sync.Once to fix a potential data race with setting the CheckRedirect function on the default http.Client 2015-09-03 13:34:45 -04:00
Seth Vargo
f0b3ad6a2a Update documentation around cookies 2015-09-03 10:36:59 -04:00
Jeff Mitchell
f1a301922d Remove cookie authentication. 2015-08-21 19:46:23 -07:00
Jeff Mitchell
6f5f247b28 The docs say that if HttpClient is nil, http.DefaultClient will be used. However, the code doesn't do this, resulting in a nil dereference. 2015-06-04 14:01:10 -04:00
Seth Vargo
f0520916d6 Improve error message when TLS is disabled
Fixes #198
2015-05-14 10:33:38 -04:00
Mitchell Hashimoto
4f2b244d72 api: human friendly error for TLS [GH-123] 2015-05-02 13:08:35 -07:00
Seth Vargo
6a104b22db Remove api dependency on http package 2015-04-23 19:58:44 -04:00
Seth Vargo
25962851ba Use VAULT_ADDR instead 2015-04-23 11:46:22 -04:00
Seth Vargo
b3cc97d71f Add docs 2015-04-23 11:45:37 -04:00
Seth Vargo
aa94080ad8 Read environment variables for VAULT_HTTP_ADDR and VAULT_TOKEN 2015-04-23 11:43:20 -04:00
Seth Vargo
d19aa41b21 Use a pointer config instead 2015-04-23 11:13:52 -04:00
Armon Dadgar
462ff7f374 api: Support redirect for HA 2015-04-20 11:30:35 -07:00
Mitchell Hashimoto
7a54437355 command/delete 2015-04-07 11:15:20 -07:00
Mitchell Hashimoto
9784fc18f2 api: SetToken 2015-03-30 21:20:23 -07:00
Mitchell Hashimoto
f547b717a7 api: re-use proper token constant 2015-03-30 11:14:51 -07:00
Mitchell Hashimoto
78ef15d413 api: store token cookie, tests 2015-03-11 17:46:42 -05:00
Mitchell Hashimoto
8894987d0b api: document jar requirement 2015-03-11 17:46:41 -05:00
Mitchell Hashimoto
6f48a19c44 api: automatically get errors in RawRequest 2015-03-11 17:46:41 -05:00
Mitchell Hashimoto
f0c804e42a api: sys methods 2015-03-11 17:46:41 -05:00
Mitchell Hashimoto
da6210d3c1 api: start the groundwork API stuff 2015-03-09 11:38:50 -07:00
Mitchell Hashimoto
cbf2d74670 api: spec 2015-03-04 13:10:10 -08:00