webdav icon indicating copy to clipboard operation
webdav copied to clipboard

`users` property in JSON config file is not recognized

Open pmeiyu opened this issue 3 years ago • 3 comments

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.

  1. 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"
        }
    ]
}

  1. Run webdav -c config.json.
  2. 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
  1. Change the config file's name from config.json to config.yaml, then run webdav -c config.yaml.
  2. 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.

pmeiyu avatar Jul 01 '21 10:07 pmeiyu

etc.

sxueck avatar Jul 02 '21 03:07 sxueck

I also encountered this bug

coderchuan avatar Sep 27 '21 16:09 coderchuan

same problem for toml config

bin16 avatar Oct 02 '21 01:10 bin16