You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
alist-dev
committed
fix(quark): refresh __puus cookie periodically to keep download signature valid
The __puus session cookie expires after about 3 hours (see #830). Quark
only re-issues it when a request does not carry the __puus field, but the
driver always sends the stored cookie, so once it expires the driver can
never refresh it in-process: file listing keeps working while downloads
fail with 403 until restart.
- add a background loop that sends a /config request without __puus and
persists the reissued cookie, with success/failure logs; refresh every
100 minutes with a random jitter of +/-5 minutes (second precision) to
avoid multiple instances refreshing at the same moment
- use the request-time cookie snapshot for the download header so it
always matches the signature generated by /file/download
- protect d.Cookie read-modify-write with a mutex and send the refresh
request with the stripped cookie as a request-local value, avoiding
races between the refresh loop and concurrent requests
- add cookie.DelStr helper and unit tests (httptest mocked endpoints,
including concurrent scenarios, -race clean)
Closes#830
0 commit comments