ux snappiness + keepalive on http-1.0

This commit is contained in:
ed 2022-06-16 20:33:09 +02:00
parent c5c1e96cf8
commit 903b9e627a
6 changed files with 14 additions and 4 deletions

View file

@ -6,11 +6,13 @@ import time
import re
from .__init__ import ANYWIN, MACOS
from .util import RootLogger, min_ex, chkcmd
from .util import min_ex, chkcmd
from .authsrv import VFS, AXS
try:
from typing import Optional, Union
from .util import RootLogger
except:
pass

View file

@ -235,7 +235,9 @@ 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.http_ver != "HTTP/1.0"
self.keepalive = not zs.startswith("close") and (
self.http_ver != "HTTP/1.0" or zs == "keep-alive"
)
self.is_https = (
self.headers.get("x-forwarded-proto", "").lower() == "https" or self.tls
)

View file

@ -97,6 +97,8 @@ class HttpConn(object):
self.log_func(self.log_src, msg, c)
def get_u2idx(self) -> U2idx:
# one u2idx per tcp connection;
# sqlite3 fully parallelizes under python threads
if not self.u2idx:
self.u2idx = U2idx(self)

View file

@ -1545,7 +1545,7 @@ html.y #tree.nowrap .ntree a+a:hover {
padding: 0 1.2em 0 0;
font-size: 4em;
opacity: 0;
animation: 1s linear .05s infinite forwards spin, .2s ease .05s 1 forwards fadein;
animation: 1s linear .15s infinite forwards spin, .2s ease .15s 1 forwards fadein;
position: absolute;
z-index: 9;
}

View file

@ -3827,6 +3827,7 @@ function tree_neigh(n) {
treectl.dir_cb = tree_scrollto;
links[act].click();
links[act].focus();
}
@ -4638,7 +4639,7 @@ var treectl = (function () {
}
function reload_tree() {
var cdir = get_vpath(),
var cdir = r.nextdir || get_vpath(),
links = QSA('#treeul a+a'),
nowrap = QS('#tree.nowrap') && QS('#hovertree.on'),
act = null;
@ -4744,6 +4745,7 @@ var treectl = (function () {
if (hpush && !no_tree)
get_tree('.', xhr.top);
r.nextdir = xhr.top;
enspin(thegrid.en ? '#gfiles' : '#files');
}
@ -4766,6 +4768,7 @@ var treectl = (function () {
if (!xhrchk(this, L.fl_xe1, L.fl_xe2))
return;
r.nextdir = null;
var cur = ebi('files').getAttribute('ts');
if (cur && parseInt(cur) > this.ts) {
console.log("reject ls");

View file

@ -11,6 +11,7 @@ copyparty/broker_mp.py,
copyparty/broker_mpw.py,
copyparty/broker_thr.py,
copyparty/broker_util.py,
copyparty/fsutil.py,
copyparty/ftpd.py,
copyparty/httpcli.py,
copyparty/httpconn.py,