diff options
author | Andrei Belov <defan@nginx.com> | 2020-05-28 18:13:06 +0300 |
---|---|---|
committer | Andrei Belov <defan@nginx.com> | 2020-05-28 18:13:06 +0300 |
commit | 733c14e991d6b2d5bdae5202ae9f090d022bc956 (patch) | |
tree | 120562db5d30e5f4f51d001397f765f5cebab999 /test/go/ns_inspect/app.go | |
parent | 6a8d4571d7fc89a951b4da80c39a93fcaa634406 (diff) | |
parent | 9d8e476c4e3695019b0a1fe3696d3411a8393de6 (diff) | |
download | unit-733c14e991d6b2d5bdae5202ae9f090d022bc956.tar.gz unit-733c14e991d6b2d5bdae5202ae9f090d022bc956.tar.bz2 |
Merged with the default branch.
Diffstat (limited to 'test/go/ns_inspect/app.go')
-rw-r--r-- | test/go/ns_inspect/app.go | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/test/go/ns_inspect/app.go b/test/go/ns_inspect/app.go index d9b561c9..4d19a796 100644 --- a/test/go/ns_inspect/app.go +++ b/test/go/ns_inspect/app.go @@ -21,10 +21,11 @@ type ( } Output struct { - PID int - UID int - GID int - NS NS + PID int + UID int + GID int + NS NS + FileExists bool } ) @@ -64,6 +65,18 @@ func handler(w http.ResponseWriter, r *http.Request) { CGROUP: getns("cgroup"), }, } + + err := r.ParseForm() + if err != nil { + w.WriteHeader(http.StatusInternalServerError) + return + } + + if fname := r.Form.Get("file"); fname != "" { + _, err = os.Stat(fname); + out.FileExists = err == nil + } + data, err := json.Marshal(out) if err != nil { w.WriteHeader(http.StatusInternalServerError) |