summaryrefslogtreecommitdiff
path: root/src/storage
AgeCommit message (Collapse)Author
2021-06-24Partition, ...: use libfmt for loggingMax Kellermann
2021-06-24Log: add libfmt supportMax Kellermann
2021-05-30clang-tidy: add explicit deleted constructorsRosen Penev
Found with cppcoreguidelines-special-member-functions Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-30clang-tidy: default virtual destructorsRosen Penev
Found with cppcoreguidelines-special-member-functions Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-17Merge branch 'v0.22.x'Max Kellermann
2021-05-17{input,storage}/curl: set CURLOPT_HTTPAUTH=CURLAUTH_BASICMax Kellermann
With the default value CURLAUTH_ANY, libcurl needs to probe for authentication methods first, and only the second request will have an Authorization header. Closes https://github.com/MusicPlayerDaemon/MPD/issues/1155
2021-03-04Merge branch 'v0.22.x'Max Kellermann
2021-03-04storage/plugins/CurlStorage: don't use glibc extension inÉrico Rolim
ParseTimePoint. %Z is a glibc extension to strptime, and is a no-op there, due to the mapping between timezone names and their definition (especially when the name comes from a different machine) being ambiguous / impossible. Time in HTTP headers is guaranteed to be UTC. Passing an unknown format to strptime() implementations that don't support it will generally cause them to return NULL, which will lead to ParseTimePoint throwing an exception and ParseTimeStamp using an unnecessary fallback. Since the timezone name goes at the end of the string, we don't need to use %Z to skip it (could be an issue in a different time stamp format), so simply removing %Z works best.
2021-02-05event/{Coarse,Fine,Far}TimerEvent: aliases for TimerEventMax Kellermann
Preparing for a variant of TimerEvent with coarse 1-second granularity, but cheaper (with a timer wheel).
2021-01-21Merge tag 'v0.22.4'Max Kellermann
release v0.22.4
2021-01-16clang-tidy: mark a bunch of variables constexprRosen Penev
Found with cppcoreguidelines-interfaces-global-init Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-01-08Remove relative path handling which was not neededVincent Petry
The original base relative path was introduced due to an erroneous test where the URL started with three slashes: "https:///" instead of two, which led to implementing handling for such cases but broke the two slashes case. This fix removes the base relative path handling because with two slashes the path is anyway always relative to the host (aka absolute URI, without host). This reverts 216f62ea1468933f4a78f17885b27e37e1393d8c and part of 74b2fc7fdca9be13cbbe4cb52b2fab573b3cf82c Signed-off-by: Vincent Petry <PVince81@yahoo.fr>
2021-01-05Merge branch 'v0.22.x'Max Kellermann
2021-01-05Use uri_has_scheme for Webdav response hrefVincent Petry
Use uri_has_scheme to find out if the href in Webdav responses is absolute to use the matching base path extraction. Signed-off-by: Vincent Petry <PVince81@yahoo.fr>
2021-01-04Webdav href in response can be relativeVincent Petry
Fixed Webdav base path stripping in cases where href is a relative path. Signed-off-by: Vincent Petry <PVince81@yahoo.fr>
2021-01-04Fix parsing propstat blocksVincent Petry
There can be more than one propstat block each with their own status code. We're only interested in the one with the 200 status, the found properties. This fixes parsing to make sure we process all propstat blocks instead of just the last one, which might have a 404 status for not-found properties. Signed-off-by: Vincent Petry <PVince81@yahoo.fr>
2021-01-04Fix Webdav storage PROPFIND requestVincent Petry
Remove additional "a:prop" in PROPFIND request to match RFC 4918 section 9.1.3. Added Content-Type header as the body is not a true multipart POST. Signed-off-by: Vincent Petry <PVince81@yahoo.fr>
2021-01-01Merge branch 'v0.22.x'Max Kellermann
2021-01-01copyright year 2021Max Kellermann
2020-12-01event/DeferEvent: split the thread-safe version into new class InjectEventMax Kellermann
2020-11-10Merge branch 'bind' of git://github.com/neheb/MPD into masterMax Kellermann
2020-11-06storage/curl: fix nullptr dereferenceMax Kellermann
Pass a std::string to PathTraitsUTF8::Relative(), implicitly casting it to std::string_view. This selects the right overload which returns std::string_view instead of `const char *`; the latter could return `nullptr` which would cause the implicit conversion of the return value to std::string_view to crash. Regression caused by commits ead208987dd and a98d627c0bd. Closes https://github.com/MusicPlayerDaemon/MPD/issues/995
2020-11-05clang-tidy: replace std::bind with lambdasRosen Penev
Found with modernize-avoid-bind Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-09-26clang-tidy: remove pointless std::moveRosen Penev
Found with performance-move-const-arg Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-09-17Merge branch 'v0.21.x' into masterMax Kellermann
2020-09-16command/file, storage/{nfs,smbclient}: use PathTraitsFS::IsSpecialFilename()Max Kellermann
Eliminate some duplicate code.
2020-07-20storage/smbclient: add Mutex attributeMax Kellermann
This per-object Mutex replaces the global `smbclient_mutex`.
2020-07-20storage/smbclient: store SmbclientStorage referenceMax Kellermann
2020-07-20*/smbclient: use the new API with SMBCCTX parameterMax Kellermann
As a side effect, the input plugin closes the SMB/CIFS connection after closing the file. This solves one part of https://github.com/MusicPlayerDaemon/MPD/issues/916
2020-07-20lib/smbclient/Context: new wrapper for SMBCCTXMax Kellermann
2020-07-06Merge branch 'v0.21.x'Max Kellermann
2020-07-06command/storage: check if storage is already mountedMax Kellermann
Mounting one storage URI twice on different mount points can lead to conflicts with the database cache file, and it doesn't make a lot of sense. But most importantly, our udisks storage plugin will unmount the disk from the kernel VFS, and if two exist, they will compete with each others. We could (and should) fix this in the udisks storage plugin, but for now, this workaround is good enough (and useful).
2020-07-06command/storage: check if mount point is busyMax Kellermann
When mounting something over a directory that is already a mount point, CompositeStorage::Mount() silently overwrites the previously mounted storage, disposing it. After that, SimpleDatabase::Mount() will fail and handle_mount() will roll back the CompositeStorage::Mount() command, effectively unmounting what was there before (and also leaking memory). Closes https://github.com/MusicPlayerDaemon/MPD/issues/918
2020-05-30Merge branch 'v0.21.x'Max Kellermann
2020-05-30use std chr functionsRosen Penev
The ones in std have overloads for const char/char. Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-05-28storage/State: disable -Wcomma to work around Boost compiler warningMax Kellermann
2020-04-23Merge tag 'v0.21.23'Max Kellermann
release v0.21.23
2020-04-22[clang-tidy] add nodiscardRosen Penev
Found with modernize-use-nodiscard Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-15storage/curl: fix path comparison when the server escapes differentlyThomas Guillem
Unescape the base path and the path coming from the server (href) to fix the comparison when the server uses different escaped characters. The outputted name need to be unescaped. Doing that before or after the HrefToEscapedName() call should not change the current behavior.
2020-04-15storage/curl: fix href when file has a '&' charThomas Guillem
If the file name is "Hello & bye", 3 CharacterData events will be sent with the State::HREF state: - "Hello%20" - "&" - "%20bye" Reproduced with files hosted on an apache2 DAV server: 2.4.38-3+deb10u3.
2020-04-06storage/{composite,local}: fix -Wnonnull warningsMax Kellermann
2020-04-03storage/Composite: use IterableSplitString()Max Kellermann
2020-04-03storage/Interface: convert URI parameters to std::string_viewMax Kellermann
2020-04-03fs/Traits: convert first Relative() parameter to std::string_viewMax Kellermann
2020-04-03storage/Composite: NextSegment() returns std::string_viewMax Kellermann
2020-04-03db,storage: pass std::string_view to PathTraits::Build()Max Kellermann
2020-04-03fs/AllocatedPath: pass std::string_view to FromUTF8()Max Kellermann
2020-04-02storage/Interface: pass std::string_view to MapChildFS()Max Kellermann
2020-03-26[clang-tidy] change integer prefixes to uppercaseRosen Penev
Found with readability-uppercase-literal-suffix Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-26event/*, ...: make GetEventLoop() constMax Kellermann