MCPcopy
hub / github.com/hashicorp/go-getter / HttpGetter

Struct HttpGetter

get_http.go:40–84  ·  view source on GitHub ↗

HttpGetter is a Getter implementation that will download from an HTTP endpoint. For file downloads, HTTP is used directly. The protocol for downloading a directory from an HTTP endpoint is as follows: An HTTP GET request is made to the URL with the additional GET parameter "terraform-get=1". This

Source from the content-addressed store, hash-verified

38// formed URL. The shorthand syntax of "github.com/foo/bar" or relative
39// paths are not allowed.
40type HttpGetter struct {
41
42 // Netrc, if true, will lookup and use auth information found
43 // in the user's netrc file if available.
44 Netrc bool
45
46 // Client is the http.Client to use for Get requests.
47 // This defaults to a cleanhttp.DefaultClient if left unset.
48 Client *http.Client
49
50 // Header contains optional request header fields that should be included
51 // with every HTTP request. Note that the zero value of this field is nil,
52 // and as such it needs to be initialized before use, via something like
53 // make(http.Header).
54 Header http.Header
55 // DoNotCheckHeadFirst configures the client to NOT check if the server
56 // supports HEAD requests.
57 DoNotCheckHeadFirst bool
58
59 // HeadFirstTimeout configures the client to enforce a timeout when
60 // the server supports HEAD requests.
61 //
62 // The zero value means no timeout.
63 HeadFirstTimeout time.Duration
64
65 // ReadTimeout configures the client to enforce a timeout when
66 // making a request to an HTTP server and reading its response body.
67 //
68 // The zero value means no timeout.
69 ReadTimeout time.Duration
70
71 // MaxBytes limits the number of bytes that will be ready from an HTTP
72 // response body returned from a server. The zero value means no limit.
73 MaxBytes int64
74
75 // XTerraformGetLimit configures how many times the client with follow
76 // the " X-Terraform-Get" header value.
77 //
78 // The zero value means no limit.
79 XTerraformGetLimit int
80
81 // XTerraformGetDisabled disables the client's usage of the "X-Terraform-Get"
82 // header value.
83 XTerraformGetDisabled bool
84}
85
86func (g *HttpGetter) Mode(ctx context.Context, u *url.URL) (Mode, error) {
87 if strings.HasSuffix(u.Path, "/") {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected