The changes simplify the `req` method by moving the
authentication-related code into the API.
This makes it easy to add additional authentication methods.
The API introduces an `Authorizer` that acts as an
authenticator factory. The authentication flow itself
is divided down into `Authorize` and `Verify` steps in order
to encapsulate and control complex authentication challenges.
The default `NewAutoAuth` negotiates the algorithms.
Under the hood, it creates an authenticator shim per request,
which delegates the authentication flow to our authenticators.
The `NewEmptyAuth` and `NewPreemptiveAuth` authorizers
allow you to have more control over algorithms and resources.
The API also allows interception of the redirect mechanism by setting
the `XInhibitRedirect` header.
This closes: #15#24#38
* bubble up request errors [#28]
* inhibit stream close on request
* add `StatusError`
* `PUT`: check if given target is a directory
* Revert "inhibit stream close on request"
Cherry-picked into branch dev-bodyclosing.
This reverts commit 2889239999.
Co-authored-by: Christoph Polcin <coco@miconoco.de>
It passes "Range: bytes=X-Y" and if the server returns HTTP 206,
we know it complied with the request.
For servers that don't understand range and return HTTP 200 instead we
discard some bytes and limit the result to emulate this behavior.
This will greatly help https://github.com/kopia/kopia which relies on
partial reads from pack blobs.
* method for creating parent collection was added to Client struct
"func (c *Client) createParentCollection(itemPath string) error" was added to request.go file
* using Client's method to create parent collection
in following methods:
Client.Write()
Client.WriteStream()
Client.copymove()
deadlock is impossible in method Client.copymove() because of paragraph #6 section 9.8.5 (https://tools.ietf.org/html/rfc4918#section-9.8.5) and paragraph #6 section 9.9.4 (https://tools.ietf.org/html/rfc4918#section-9.9.4) of RFC 4918 (https://tools.ietf.org/html/rfc4918)
* install dependencies script was added to Travis-CI file
* testing was added to Travis-CI file
* error wrapping was removed from Client.put() method
* using an early return on error in case of 409 in Client.Write() method