Commit Graph

64 Commits

Author SHA1 Message Date
shoopea f073d3021d remove all debug 2024-01-20 12:33:07 +01:00
shoopea 45e36d9254 details 2024-01-20 12:11:08 +01:00
shoopea e3bd2a5fb2 even more debug 2024-01-20 11:59:18 +01:00
Yuriy Zaytsev 3cf99ede06 Fix missing last modified time on Stat() 2023-06-22 13:42:44 +02:00
Christoph Polcin d59c1705b2 Explicit assignment of struct fields 2023-06-22 13:32:03 +02:00
Christoph Polcin ca40e2802e Feat: Authentication API
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
2023-06-22 13:32:03 +02:00
Steffen Brüheim 60ec5ad560 Fixes #64 Support for cookies
expose a SetJar method to set a http.CookieJar to the http client
2022-11-09 18:19:24 +01:00
Christoph Polcin bf6102194f fix: Write creates parent collections on 404 2022-10-16 00:59:14 +02:00
zhijian e70a598e94
supports get range offset with unkown length (#58)
https://www.rfc-editor.org/rfc/rfc9110.html#name-byte-ranges
2022-10-12 18:09:28 +02:00
Ringo Hoffmann c7b1ff8a5e
Improve Error Handling (#54)
* 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>
2022-01-28 17:20:35 +01:00
Jarek Kowalski 741fdbda3d added ReadStreamRange() method to efficiently read a range of data
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.
2021-11-04 23:32:32 -07:00
Felix Pojtinger 4145fa842c Add ability to define custom interceptors (fixes #35) 2021-04-27 23:12:51 +02:00
Nick Kratzke d02a1ebcd2 switched to PathUnescape 2021-02-03 21:16:30 +01:00
Nick 3ed042db71 fix unescape 2021-02-03 15:25:12 +01:00
Jarek Kowalski 617404b525 fixed panic due to concurrent map writes
Fixes #36
2020-09-28 11:17:19 +02:00
vitalii 8de8ce169b Merge remote-tracking branch 'upstream/master' 2018-07-17 14:00:43 +03:00
Vitalii 83e3d1e31e Creating parent collection method was added (#22)
* 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
2018-07-14 01:48:30 +02:00
vitalii 68824ef55e createParentCollection() function was added 2018-06-21 16:37:02 +03:00
vitalii 876ef52924 not all webdav servers returns "Dav" header 2018-06-20 03:21:30 +03:00
David b45378c08f Check status on every request to fix #14 2018-06-18 10:02:01 -05:00
Christoph Polcin fbcb29d33e docs 2018-05-25 23:59:53 +02:00
David 6d8c168f72 Add Authenticator interface and Digest auth support 2018-05-25 22:40:13 +02:00
Christoph Polcin 1e4b7a5554 refactor client 2018-05-24 01:24:27 +02:00
Christoph Polcin 34368960d0 refactor 2018-05-23 14:15:46 +02:00
Christoph Polcin 7ea52a8e4f fix close 2018-05-17 01:24:14 +02:00
Abdurrahman 0e7fe90d28 Fetch ContentType and ETag 2018-05-17 01:22:58 +02:00
Christoph Polcin 410e447c49 simplify 409 write error handler 2018-05-16 23:39:37 +02:00
Keith Ball 73b90bf27e Do not do a read on the root on connect 2018-05-16 14:17:35 +02:00
Keith Ball 9c695fe0df Return codes 2018-05-16 14:15:47 +02:00
Christoph Polcin 732590873e docs 2018-05-16 14:05:18 +02:00
Aaron Bieber b290410ef9 add a bit of doc, cleanup some warnings 2018-05-16 10:42:38 +02:00
Christoph Polcin 49e0e45d8f fmt 2018-05-15 11:51:59 +02:00
Christoph Polcin a3c4dbab4a add SetTimeout 2018-05-15 11:51:53 +02:00
Olof-Joachim Frahm a11466bd13 Handle error response when reading a file. 2017-12-20 10:53:49 +01:00
Christoph Polcin e3cd1f98e7 Merge pull request #6 from ProgramYazar/master
fix delete for yandex
2017-09-19 07:22:16 +02:00
Engin KIZILGÜN 2b5dab74d3 fix delete for yandex
204 success added
2017-09-18 15:54:19 +03:00
Alejandro Alvarez Ayllon 79a29f3ad5 Add SetTransport method 2017-08-07 12:13:13 +02:00
Daniel Eyring 12fe295146 SetHeader method added to client 2016-07-27 14:36:21 +02:00
Christoph Polcin 8f99657223 client: dry 2015-12-09 10:02:37 +01:00
Christoph Polcin b12f1c1b33 Merge pull request #2 from mattn/handle-href
look href if displayname not exists

thanks!
2015-12-09 09:56:31 +01:00
Yasuhiro Matsumoto 33816041d6 Use href instead of displayname for Name() 2015-12-09 17:35:24 +09:00
Yasuhiro Matsumoto 87bbafc0c0 directory should have mod-time 2015-11-16 22:41:20 +09:00
Christoph Polcin a3cc4ebe01 add Stat() 2014-10-27 17:02:28 +01:00
Christoph Polcin 0c00ff98a3 close body 2014-10-27 16:29:57 +01:00
Christoph Polcin b947e819ed refactor req & reqDo 2014-10-27 16:19:17 +01:00
Christoph Polcin 05b47fd0dc add ReadStream & WriteStream 2014-10-27 15:17:54 +01:00
Christoph Polcin e4fac5eebf implement READ & WRITE 2014-10-27 14:32:16 +01:00
Christoph Polcin 47076d6487 add Rename and Copy 2014-10-24 14:09:50 +02:00
Christoph Polcin b8d7beb48c Connect() will fail on non collection roots 2014-10-24 12:40:49 +02:00
Christoph Polcin f728828956 ReadDir will fail on non collections 2014-10-24 12:39:35 +02:00