Files
moby/api/server
Sebastiaan van Stijn e2d2834be1 api/server: Server.CreateMux: register debug endpoints with correct methods
The debug handlers were created for GET methods, but were registered for
any method;

    curl -s -XGET --unix-socket /var/run/docker.sock http://localhost/debug/vars | jq -c .cmdline
    ["dockerd","--debug"]
    curl -s -XPOST --unix-socket /var/run/docker.sock http://localhost/debug/vars | jq -c .cmdline
    ["dockerd","--debug"]
    curl -s -XDELETE --unix-socket /var/run/docker.sock http://localhost/debug/vars | jq -c .cmdline
    ["dockerd","--debug"]

After this patch, they're only registered with the intended method, and a
404 is returned for incorrect ones;

    curl -s -XGET --unix-socket /var/run/docker.sock http://localhost/debug/vars | jq -c .cmdline
    ["dockerd","--debug"]
    curl -s -XPOST --unix-socket /var/run/docker.sock http://localhost/debug/vars
    {"message":"page not found"}
    curl -s -XDELETE --unix-socket /var/run/docker.sock http://localhost/debug/vars
    {"message":"page not found"}

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-09 15:55:25 +01:00
..