Age | Commit message (Collapse) | Author |
|
Now NetworkReadStream, which is used in DownloadRequest, which is used
in FolderDownloadRequest, returns progress information provided by
libcurl.
|
|
Uses dynamically allocated buffer now.
|
|
Now those support POST multipart/form upload.
|
|
|
|
|
|
The passed buffer is not changed, so could be `const`.
You might see that `postFields.c_str()` is `buffer`. Yet, as it's
`postFields`, it's used for POST in curl_easy_setopt(), which copies the
passed buffer. When `buffer` is used for upload, it's an actual bytes
buffer, kept in CurlRequest.
|
|
|
|
"networkreadstream.cpp:51:2: error: delegating constructors are permitted only in C++11"
|
|
Used in SavesSyncRequest to update Storage's last sync date.
|
|
Tried to use it everywhere I should've use it.
|
|
Includes NetworkReadStream PATCH method and Headers remembering feature.
|
|
It now keeps newly added Requests in separate array, so iterators don't
break when one adds a Request while ConnMan iterates its array.
The array is also shielded with mutex.
|
|
It also shows a "sync disabled" icon in case it has a savepath override.
|
|
CloudIcon can easily use CloudMan.isWorking()
|
|
|
|
|
|
It's not a Request again, but still it controls ConnMan's timer.
|
|
CloudIcon is now a Request which is automatically added once first
Request is added to ConnMan. When icon decides it should disappear, it
gets FINISHED, so ConnMan would switch off the timer if it was the last
Request.
|
|
That required ConnMan's timer stopping. Would be fixed in the next
commit.
|
|
Now it loads the surface once.
|
|
I didn't like how FINISHED Requests were waiting until the next
interateRequests() call to be removed when we could easily remove those
after they changed their state in their handle().
|
|
Now only icon is shown.
|
|
To achieve smoother animation, ConnectionManager's timer now is 20 times
more frequent.
I'm encountering some strange libcurl.dll segfault problem when I close
the application while some Requests are active. It's not
CloudIcon-related, so it's more likely related to this 20 FPS timer.
This problem shows up only in Visual Studio for me.
|
|
It has its own GoogleDriveTokenRefresher and knows how to do info().
This commit also contains JSON int -> long long int fix and
CurlJsonRequest '\n' -> ' ' fix.
|
|
|
|
It now terminates active Requests.
|
|
It now keeps track of how many Requests are running.
To achieve that, we had to pass a callback to ConnectionManager, so each
Request has a callback paired with it. If that's one of Storage's
Requests, it has a callback, which would decrease a counter. When
Storage adds a Request, it also increases a counter and passes that
callback. Callback is called by ConnMan when Request is deleted.
isWorking() returns true if there is at least one Request running.
|
|
Doesn't support server's requested ranges yet.
Commit also adds some PUT-related code in NetworkReadStream and
CurlRequest.
|
|
Added ErrorResponse and ErrorCallback. Each Request now has an
ErrorCallback, which should be called instead of usual callback in case
of failure.
|
|
|
|
|
|
I forgot to delete callbacks!
|
|
|
|
It now just extends CurlJsonRequest, not wraps one.
|
|
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.
|
|
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.
|
|
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.
|
|
Doesn't work when token is invalid, though.
|
|
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.
|
|
Type safety first.
|
|
With new ConnectionManager upgrade Requests indicate that they are
finished with RequestInfo.state. No need to use handle() return value
anymore.
|
|
Can be used with Callback<T> (means it's still type safe). It's used to
pass not only Request id to user's callback, but also a value user
wanted.
void *data field is removed from RequestInfo.
|
|
ConnectionManager upgrade: it now contains a special struct for each
request, so you can access request status and data by request id.
|
|
(Upgrading ConnectionManager step by step.)
|
|
It might be not that easy to restart the request after new token
received, though.
|
|
It reads the passed NetworkReadStream and prints its contents onto
console (for now). It would be writing contents into file.
To simplify work with raw NetworkReadStream there is a new CurlRequest.
It basically does nothing, but as ConnMan handles transfers only if
there is an active Request, you need some Request to get
NetworkReadStream working. Thus, there is a CurlRequest, which is active
until NetworkReadStream is completely read. CurlRequest also has useful
addHeader() and addPostField() methods in order to customize the request
easily. Use execute() method to get its NetworkReadStream.
DropboxStorage implements streamFile() and download() API methods. As
DownloadRequest is incomplete, it is not actually downloading a file,
though.
|
|
It doesn't support any "has_more", doesn't call user's callback and just
prints JSON instead of parsing in into an array of files.
I believe it would become DropboxListDirectoryRequest in the next
commit.
|
|
It now contains not a pointer to a function, but an actual pointer,
which must be freed.
|
|
Cleaned up all example code and old callbacks.
New Callback classes are introduced in "common/callback.h" and
documented.
|
|
This commit also adds GlobalFunctionCallback, because it was needed in
order to replace plain C pointers to functions (which were used in
Request) into our object-oriented BaseCallback pointers.
|