Commit graph

10 commits

Author SHA1 Message Date
Alexander Tkachev
b39f46788a CLOUD: Add OneDriveUploadRequest
Doesn't support server's requested ranges yet.

Commit also adds some PUT-related code in NetworkReadStream and
CurlRequest.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
eb63b50b7f CLOUD: Refactor Request
Added ErrorResponse and ErrorCallback. Each Request now has an
ErrorCallback, which should be called instead of usual callback in case
of failure.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
001b417f33 CLOUD: Fix OneDriveTokenRefresher
It was calling finish(), causing stack overflow.

Some minor changes are added also.
2016-08-24 16:07:55 +06:00
Peter Bozsó
81c34adaef Fix comment formatting 2016-08-24 16:07:55 +06:00
Alexander Tkachev
6c01edc57a CLOUD: Simplify OneDriveTokenRefresher
It now just extends CurlJsonRequest, not wraps one.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
dcbaeb57c4 CLOUD: Fix OneDriveTokenRefresher
Failed to update token in header when "Bearer" was used instead of
"bearer".
2016-08-24 16:07:55 +06:00
Alexander Tkachev
1348befe29 CLOUD: Add access to CurlRequest's Stream
One can access CurlRequest's NetworkReadStream in order to find out HTTP
response code or some other Stream-related data.

OneDriveTokenRefresher uses it to print some info on that 404 error I'm
trying to troubleshoot.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
98150beb38 CLOUD: Refactor ConnectionManager/Requests system
ConnectionManager now storages Request * (not generates ids for it),
Requests have control on their RequestState, RequestIdPair is now called
Response and storages Request * with some response together.

All related classes are changed to use it in more clean and
understandable way.

Request, RequestState and Response are carefully commented/documented.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
83b349a033 CLOUD: Make OneDriveStorage::download() work fine
Well, it takes two API calls instead of one now, but there are no
problems with expired token because of it.

This commit changes Storage::streamFile() to pass NetworkReadStream *
through callback.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
8f6bcdf55d CLOUD: Add OneDriveTokenRefresher
OneDriveTokenRefresher is a CurlJsonRequest replacement for
OneDriveStorage methods. It behaves very similarly, but checks received
JSON before passing it to user. If it contains "error" key, it attempts
to refresh the token through OneDriveStorage, and then restarts the
original request, so user won't notice that there ever was an error.
2016-08-24 16:07:55 +06:00