diff --git a/contrib/nginx/copyparty.conf b/contrib/nginx/copyparty.conf index 072a437a..c625fceb 100644 --- a/contrib/nginx/copyparty.conf +++ b/contrib/nginx/copyparty.conf @@ -10,6 +10,8 @@ # # you may also consider adding -j0 for CPU-intensive configurations # (not that i can really think of any good examples) +# +# on fedora/rhel, remember to setsebool -P httpd_can_network_connect 1 upstream cpp { server 127.0.0.1:3923; diff --git a/copyparty/authsrv.py b/copyparty/authsrv.py index 1b168fb3..77fca110 100644 --- a/copyparty/authsrv.py +++ b/copyparty/authsrv.py @@ -370,7 +370,6 @@ class VFS(object): def _find(self, vpath: str) -> tuple["VFS", str]: """return [vfs,remainder]""" - vpath = undot(vpath) if vpath == "": return self, "" @@ -381,7 +380,7 @@ class VFS(object): rem = "" if name in self.nodes: - return self.nodes[name]._find(rem) + return self.nodes[name]._find(undot(rem)) return self, vpath @@ -389,7 +388,7 @@ class VFS(object): self, vpath: str, uname: str ) -> tuple[bool, bool, bool, bool, bool, bool]: """can Read,Write,Move,Delete,Get,Upget""" - vn, _ = self._find(vpath) + vn, _ = self._find(undot(vpath)) c = vn.axs return ( uname in c.uread or "*" in c.uread, @@ -419,7 +418,7 @@ class VFS(object): self.log("vfs", "invalid relpath [{}]".format(vpath)) raise Pebkac(404) - vn, rem = self._find(vpath) + vn, rem = self._find(undot(vpath)) c: AXS = vn.axs for req, d, msg in [ diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 9083277e..0190aec3 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -119,7 +119,6 @@ class HttpCli(object): # placeholders; assigned by run() self.keepalive = False self.is_https = False - self.is_proxied = False self.is_vproxied = False self.in_hdr_recv = True self.headers: dict[str, str] = {} @@ -256,7 +255,7 @@ class HttpCli(object): self.is_ancient = self.ua.startswith("Mozilla/4.") zs = self.headers.get("connection", "").lower() - self.keepalive = not zs.startswith("close") and ( + self.keepalive = "close" not in zs and ( self.http_ver != "HTTP/1.0" or zs == "keep-alive" ) self.is_https = ( @@ -280,7 +279,6 @@ class HttpCli(object): self.log_src = self.conn.set_rproxy(self.ip) self.is_vproxied = bool(self.args.R) - self.is_proxied = True if self.is_banned(): return False @@ -1149,7 +1147,11 @@ class HttpCli(object): if "multipart/form-data" in ctype: return self.handle_post_multipart() - if "text/plain" in ctype or "application/xml" in ctype: + if ( + "application/json" in ctype + or "text/plain" in ctype + or "application/xml" in ctype + ): return self.handle_post_json() if "application/octet-stream" in ctype: diff --git a/copyparty/svchub.py b/copyparty/svchub.py index b2663925..d12cdb4f 100644 --- a/copyparty/svchub.py +++ b/copyparty/svchub.py @@ -306,11 +306,9 @@ class SvcHub(object): t = "found URL in --webroot; it should be just the location, for example /foo/bar" raise Exception(t) - R = R.strip("/") - if R: - al.R = R - al.SR = "/" + R - al.RS = R + "/" + al.R = R = R.strip("/") + al.SR = "/" + R if R else "" + al.RS = R + "/" if R else "" return True