diff options
| author | Adnan Maolood <[email protected]> | 2021-02-23 18:56:18 -0500 |
|---|---|---|
| committer | Adnan Maolood <[email protected]> | 2021-02-23 18:56:18 -0500 |
| commit | b3e8d9ccf3b548347e828b2cabffd4eebd475a7c (patch) | |
| tree | 6e6fabdb87d8a73c38e664d6f6890d4bc6cb1a9d | |
| parent | Use HandlerFunc to implement StatusHandler (diff) | |
| download | go-gemini-b3e8d9ccf3b548347e828b2cabffd4eebd475a7c.tar.xz go-gemini-b3e8d9ccf3b548347e828b2cabffd4eebd475a7c.zip | |
client: Clarify usage of contexts
| -rw-r--r-- | client.go | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -30,8 +30,9 @@ type Client struct { } // Get sends a Gemini request for the given URL. -// If the provided context is canceled or times out, the request -// is aborted and the context's error is returned. +// The context controls the entire lifetime of a request and its response: +// obtaining a connection, sending the request, and reading the response +// header and body. // // An error is returned if there was a Gemini protocol error. // A non-2x status code doesn't cause an error. @@ -48,15 +49,14 @@ func (c *Client) Get(ctx context.Context, url string) (*Response, error) { } // Do sends a Gemini request and returns a Gemini response. -// If the provided context is canceled or times out, the request -// is aborted and the context's error is returned. +// The context controls the entire lifetime of a request and its response: +// obtaining a connection, sending the request, and reading the response +// header and body. // // An error is returned if there was a Gemini protocol error. // A non-2x status code doesn't cause an error. // // If the returned error is nil, the user is expected to close the Response. -// -// Generally Get will be used instead of Do. func (c *Client) Do(ctx context.Context, req *Request) (*Response, error) { if ctx == nil { panic("nil context") |