Commit Graph

266 Commits

Author SHA1 Message Date
Max Kellermann
3278ad2ed8 storage/State: remove obsolete Boost compiler warning workaround 2022-11-17 05:32:29 +01:00
Max Kellermann
2e453ef58a storage/State: use std::hash() instead of boost::crc
Also eliminate the useless std::set.
2022-11-17 05:28:53 +01:00
Max Kellermann
a5d04be21f storage/State: add noexcept 2022-11-17 05:19:11 +01:00
Max Kellermann
98c24d1a32 Merge branch 'v0.23.x' 2022-11-12 12:29:21 +01:00
Max Kellermann
c2d0f35e7a storage/meson.build: move StorageState.cxx to "mpd" executable
Fixes spurious linker errors.
2022-11-12 12:24:48 +01:00
Max Kellermann
ab99a57997 test/meson.build: reduce test_translate_song. dependencies 2022-11-12 12:17:35 +01:00
Max Kellermann
d6d0f78e93 release v0.23.10
-----BEGIN PGP SIGNATURE-----
 
 iQJBBAABCgArFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAmNJ2e0NHG1heEBibGFy
 Zy5kZQAKCRAjbopYxttFEjBYEACk4QtVnD52sGtz0CwThFYzekvkZHOBcP2fYOH7
 rVcQaNmV7Fpnv+iz+k7zrqhs/A8FgQq6KUNpUn3gzxae4KsA7i1yEpopIqfzRh71
 eVrjTGijMirddehsxKbkjZ1TZy5S+SkZ+Bu965qzXUZuIrErKm4m5xqkIxXBHMEc
 twK9BSCqlTT2vpND5cmX90T/NBDgZd3uQxQP2ohWjVXvg9ou2gtns18ZdYUVRTym
 rLqRLfx1rG1lS8hzKqUqt9YxbWSD606T4giC2vYg2+2OFA9VFh3TNCSaFgWEJMZe
 ou6iaX+aSoCP+H6nktxfYravwdmHvBseRtrOouxPd8Br2k1eSQGXEVlZVTKrpBME
 OZnncEGqN27GggYH1RyVZ6showJ7G05HOhGFDDs8ABR0EbAbNkGvhrjl8cGXONYH
 ScTBbvqkTrhRMOOSmiAp7X1eLJ4QICAfhCV85YzSV93u69egO1MQLYzVYUurOOyt
 TuT+XbUD+Irk3DrHvhxs/IE+ciIvilFsvCmeNjCAyH4ZPvvHt/AIskQNyF3Jj720
 XKjtq6rMF9bizut/kboPgsVQoFbnj7ncCaIZ90h27obeqqiXajTx7ixJldvwDbrp
 yKQY6xDdm7DZChqYF0KKWWzLt2BoAzqVPW3zgRfJRqb9HtQ+ZVJuljvV8bBVFKN1
 zIA4Nw==
 =GQl1
 -----END PGP SIGNATURE-----

Merge tag 'v0.23.10'

release v0.23.10
2022-10-14 23:56:33 +02:00
Max Kellermann
5f9438dae6 storage/curl: include cleanup 2022-09-30 18:16:46 +02:00
BurroCargado
99e65c58ce storage/curl: make timestamp parsing more robust
According to the latest WebDAV specification (RFC4918),
timestamp string in the getlastmodified property is formatted
as rfc1123-date, such as "Sun, 06 Nov 1994 08:49:37 GMT".
However, to process responses from servers in the older style
format specified in RFC2518, timestamps in the HTTP-date format
had better be accepted.

As described in the libcurl api documentation, curl_getdate() can handle
timestamp strings in HTTP-date formats, including rfc1123-date.

https://www.rfc-editor.org/rfc/rfc4918#section-15.7
https://www.rfc-editor.org/rfc/rfc2518.html#section-13.7
https://curl.se/libcurl/c/curl_getdate.html
2022-09-29 18:19:30 +02:00
BurroCargado
df71b07e9d storage/curl: fix can't get timestamp of remote file 2022-09-29 18:19:03 +02:00
Max Kellermann
2694195215 storage/curl: add noexcept and [[gnu::pure]] 2022-09-29 18:18:18 +02:00
Max Kellermann
cc0def15c4 Copyright year 2022 2022-07-14 17:59:35 +02:00
Max Kellermann
b52b0ac85a *: use BufferedOutputStream::Fmt() 2022-07-13 13:10:14 +02:00
Max Kellermann
c7a8fc91c0 storage/curl: use std::string_view instead of StringView 2022-07-04 15:04:31 +02:00
Max Kellermann
19d2864c34 lib/curl/Headers: central type definition for the header map 2022-07-01 12:17:36 +02:00
Max Kellermann
e6bb6c59ec storage/Composite: use std::string_view 2022-07-01 11:29:11 +02:00
Max Kellermann
1da09f5b1b lib/curl: use std::span 2022-06-29 17:37:12 +02:00
Max Kellermann
d256d3dabe util/StringCompare: use std::string_view instead of StringView 2022-05-31 13:24:45 +02:00
Max Kellermann
1e548fb6e3 lib/curl/Headers: central type definition for the header map 2022-02-14 18:19:05 +01:00
Max Kellermann
a5fa43b526 fs/io: move to io/ 2021-12-03 14:35:41 +01:00
Max Kellermann
8681a3d74c replace TextFile references with LineReader 2021-12-03 14:22:56 +01:00
Rosen Penev
250011f016 return by braced init list
shorter

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-22 23:28:08 -08:00
Rosen Penev
4e0e4c00bf treewide: replace lock_guard with scoped_lock
SonarLint reports the latter to be better:

std::scoped_lock basically provides the same feature as std::lock_guard,
but is more generic: It can lock several mutexes at the same time, with a
deadlock prevention mechanism (see {rule:cpp:S5524}). The equivalent code
to perform simultaneous locking with std::lock_guard is significantly more
complex. Therefore, it is simpler to use std::scoped_lock all the time,
even when locking only one mutex (there will be no performance impact).

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-11 17:13:03 -08:00
Max Kellermann
771c46032f meson.build: add missing libfmt dependencies
Fixes https://github.com/MusicPlayerDaemon/MPD/discussions/1281

The problem occurred when there was libfmt-dev installed, but it was
too old (e.g. on Debian Buster), and Meson used the wrap fallback.
Those internal MPD libraries where the libfmt dependency was not
declared were still using the old system libfmt headers, which are not
ABI-compatible with MPD's own libfmt build.
2021-10-15 14:26:59 +02:00
Max Kellermann
85611aa456 storage/smbclient: add StoragePlugin.prefixes
Should have been part of commit
ef24cfa523

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1279
2021-10-15 10:24:30 +02:00
Max Kellermann
72f6e018e7 Log: remove the obsolete printf-style functions 2021-10-13 17:41:19 +02:00
Max Kellermann
f510564d9d more [[gnu::...]] attributes 2021-10-13 12:07:05 +02:00
Max Kellermann
ef24cfa523 storage/Plugin: add "prefixes" 2021-10-06 20:14:01 +02:00
Max Kellermann
6f539cfcd6 Partition, ...: use libfmt for logging 2021-06-24 21:40:11 +02:00
Max Kellermann
0185d58a2b Log: add libfmt support 2021-06-24 21:14:42 +02:00
Rosen Penev
220d2bf026 clang-tidy: add explicit deleted constructors
Found with cppcoreguidelines-special-member-functions

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-30 22:47:20 -07:00
Rosen Penev
9ef1cf15a9 clang-tidy: default virtual destructors
Found with cppcoreguidelines-special-member-functions

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-30 22:46:46 -07:00
Max Kellermann
a2bdac571a Merge branch 'v0.22.x' 2021-05-17 19:33:15 +02:00
Max Kellermann
638dfc3981 {input,storage}/curl: set CURLOPT_HTTPAUTH=CURLAUTH_BASIC
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-05-17 19:26:05 +02:00
Max Kellermann
ef1acb4e2f Merge branch 'v0.22.x' 2021-03-04 18:56:29 +01:00
Érico Rolim
c95e3dc065 storage/plugins/CurlStorage: don't use glibc extension in
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-03-04 17:48:23 +01:00
Max Kellermann
def962b6cb event/{Coarse,Fine,Far}TimerEvent: aliases for TimerEvent
Preparing for a variant of TimerEvent with coarse 1-second
granularity, but cheaper (with a timer wheel).
2021-02-05 18:16:05 +01:00
Max Kellermann
8279cafd6d release v0.22.4
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAmAJqgAQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEg2QEACJLeN2mk2RU7Iqxbh/ekwm6aTM8D6bx8RH
 Xys4l1YAFQ0cg7sKZwMqefedGJG2j8CORbihYIF6Z8EvFsAiI6I3LjElfXrmnAc0
 Y9SnWHIR5vxlSQgyqPlJ0jl213uzoHHpel8PpEJbTtYONT+8f3fQEuLpO4/uWOIT
 S6mlX16vI0/Ydp//8UIazUUvjar1pPvBnSEZ0JZsZl8RTYlS/4SOfqpHnhhWnWpO
 9RXlLP9Zo68rJzNhUPwRj7NkyVEkg74xpjHOWoyeTMNQ6tKMQn8b4jb/LcBfj6hk
 I7mof5oX0aS+GyYaehKi9c9Az7wUcBxnnaN02qlAaSutcuox7ce70fKMtiAXRN0o
 T9mFSJm1JKqHZb1dFvxqSqFjVr7eO9XCxHqaEqTbXCT+CL/6AJQZi5SVcX4gCY1P
 NSM3Jnydjr73WFLmEfjCkWLTdtiJhY/2Q/J6+vcILMb3W2y5FaSHZTOFbxVG4nMM
 spoQ27b7PoB9MbxLR3QJkYLa0WE3FrTORYgsH8Po7ZcCU9+JvqDSBnGXxx+Yv+JJ
 dKMI5bEAvPziodSHHQXgD4lhx744JuiLAJNtlSYJvev1s2Irf2TtMHdmGERHQZwH
 5cr9sQLgyHCLvTBDGt1dVZq/Z0T/PCkweIa5cT6ZBAim1hs7g20g8ksyFK2ZPUbB
 vEGBNcuMIg==
 =CEEr
 -----END PGP SIGNATURE-----

Merge tag 'v0.22.4'

release v0.22.4
2021-01-21 17:42:26 +01:00
Rosen Penev
594dfe572b
clang-tidy: mark a bunch of variables constexpr
Found with cppcoreguidelines-interfaces-global-init

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-01-16 18:35:31 -08:00
Vincent Petry
ec0d3ac95d
Remove relative path handling which was not needed
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 216f62ea14 and part of 74b2fc7fdc

Signed-off-by: Vincent Petry <PVince81@yahoo.fr>
2021-01-08 16:50:27 +01:00
Max Kellermann
81ea749248 Merge branch 'v0.22.x' 2021-01-05 13:11:29 +01:00
Vincent Petry
74b2fc7fdc
Use uri_has_scheme for Webdav response href
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-05 12:04:08 +01:00
Vincent Petry
216f62ea14
Webdav href in response can be relative
Fixed Webdav base path stripping in cases where href is a relative path.

Signed-off-by: Vincent Petry <PVince81@yahoo.fr>
2021-01-04 21:50:03 +01:00
Vincent Petry
b7d0001390
Fix parsing propstat blocks
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-04 21:49:38 +01:00
Vincent Petry
687788e4d3
Fix Webdav storage PROPFIND request
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-04 14:28:42 +01:00
Max Kellermann
abbd980671 Merge branch 'v0.22.x' 2021-01-01 19:59:15 +01:00
Max Kellermann
5348f8c9c8 copyright year 2021 2021-01-01 19:54:28 +01:00
Max Kellermann
774b4313f2 event/DeferEvent: split the thread-safe version into new class InjectEvent 2020-12-01 17:14:24 +01:00
Max Kellermann
a9714e73c8 Merge branch 'bind' of git://github.com/neheb/MPD into master 2020-11-10 16:02:34 +01:00
Max Kellermann
f849b07766 storage/curl: fix nullptr dereference
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 ead208987d and a98d627c0b.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/995
2020-11-06 15:35:47 +01:00