webdav
webdav copied to clipboard
`users` property in JSON config file is not recognized
webdav claims to support JSON, YAML and TOML configuration file. But JSON support is not working as advertised. It has a weird bug.
The webdav
I am using is built from tag v4.0.0.
- Put the following configuration into a file named
config.json
.
{
"address": "0.0.0.0",
"port": 8888,
"auth": true,
"scope": ".",
"users": [
{
"password": "password",
"username": "username"
}
]
}
- Run
webdav -c config.json
. - Try to log in from a client. The authorization will fail.
shell> http -a username:password OPTIONS localhost:8888
HTTP/1.1 401 Unauthorized
Content-Length: 15
Content-Type: text/plain; charset=utf-8
Date: Thu, 01 Jul 2021 10:11:35 GMT
Www-Authenticate: Basic realm="Restricted"
X-Content-Type-Options: nosniff
Not authorized
- Change the config file's name from
config.json
toconfig.yaml
, then runwebdav -c config.yaml
. - Try to log in from a client. This time the authorization will succeed.
shell> http -a username:password OPTIONS localhost:8888
HTTP/1.1 200 OK
Allow: OPTIONS, LOCK, DELETE, PROPPATCH, COPY, MOVE, UNLOCK, PROPFIND
Content-Length: 0
Date: Thu, 01 Jul 2021 10:13:24 GMT
Dav: 1, 2
Ms-Author-Via: DAV
Www-Authenticate: Basic realm="Restricted"
So users
property in config.json
is not recognized by webdav
. But it's recognized when the config file name has the .yaml
suffix.
etc.
I also encountered this bug
same problem for toml config