mirror of
https://github.com/9001/copyparty.git
synced 2026-03-31 20:43:15 +10:00
logging
This commit is contained in:
@@ -34,6 +34,7 @@ class HttpCli(object):
|
||||
self.auth = conn.auth
|
||||
self.log_func = conn.log_func
|
||||
self.log_src = conn.log_src
|
||||
self.tls = hasattr(self.s, "cipher")
|
||||
|
||||
self.bufsz = 1024 * 32
|
||||
self.absolute_urls = False
|
||||
@@ -134,16 +135,6 @@ class HttpCli(object):
|
||||
uparam["raw"] = True
|
||||
uparam["dots"] = True
|
||||
|
||||
if hasattr(self.s, "cipher"):
|
||||
self.ssl_suf = "".join(
|
||||
[
|
||||
" \033[3{}m{}".format(c, s)
|
||||
for c, s in zip([6, 3, 6], self.s.cipher())
|
||||
]
|
||||
)
|
||||
else:
|
||||
self.ssl_suf = ""
|
||||
|
||||
try:
|
||||
if self.mode in ["GET", "HEAD"]:
|
||||
return self.handle_get() and self.keepalive
|
||||
@@ -221,7 +212,7 @@ class HttpCli(object):
|
||||
|
||||
logmsg += " [\033[36m" + rval + "\033[0m]"
|
||||
|
||||
self.log(logmsg + self.ssl_suf)
|
||||
self.log(logmsg)
|
||||
|
||||
# "embedded" resources
|
||||
if self.vpath.startswith(".cpr"):
|
||||
@@ -255,7 +246,7 @@ class HttpCli(object):
|
||||
return self.tx_browser()
|
||||
|
||||
def handle_options(self):
|
||||
self.log("OPTIONS " + self.req + self.ssl_suf)
|
||||
self.log("OPTIONS " + self.req)
|
||||
self.send_headers(
|
||||
None,
|
||||
204,
|
||||
@@ -268,7 +259,7 @@ class HttpCli(object):
|
||||
return True
|
||||
|
||||
def handle_put(self):
|
||||
self.log("PUT " + self.req + self.ssl_suf)
|
||||
self.log("PUT " + self.req)
|
||||
|
||||
if self.headers.get("expect", "").lower() == "100-continue":
|
||||
try:
|
||||
@@ -279,7 +270,7 @@ class HttpCli(object):
|
||||
return self.handle_stash()
|
||||
|
||||
def handle_post(self):
|
||||
self.log("POST " + self.req + self.ssl_suf)
|
||||
self.log("POST " + self.req)
|
||||
|
||||
if self.headers.get("expect", "").lower() == "100-continue":
|
||||
try:
|
||||
@@ -943,7 +934,7 @@ class HttpCli(object):
|
||||
# 512 kB is optimal for huge files, use 64k
|
||||
open_args = [fsenc(fs_path), "rb", 64 * 1024]
|
||||
use_sendfile = (
|
||||
not self.ssl_suf
|
||||
not self.tls #
|
||||
and not self.args.no_sendfile
|
||||
and hasattr(os, "sendfile")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user