mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 17:12:13 -06:00
TLS error handling
This commit is contained in:
parent
b0c2fc91b2
commit
0bfb778446
12
README.md
12
README.md
|
@ -3,6 +3,7 @@
|
|||
* http file sharing hub (py2/py3)
|
||||
* MIT-Licensed, 2019-05-26, ed @ irc.rizon.net
|
||||
|
||||
|
||||
## summary
|
||||
|
||||
turn your phone or raspi into a portable file server with resumable uploads/downloads using IE6 or any other browser
|
||||
|
@ -11,6 +12,7 @@ turn your phone or raspi into a portable file server with resumable uploads/down
|
|||
* *resumable* uploads need `firefox 12+` / `chrome 6+` / `safari 6+` / `IE 10+`
|
||||
* code standard: `black`
|
||||
|
||||
|
||||
## status
|
||||
|
||||
* [x] sanic multipart parser
|
||||
|
@ -49,6 +51,7 @@ after the initial setup (and restarting bash), you can launch copyparty at any t
|
|||
|
||||
|
||||
# dev env setup
|
||||
|
||||
```sh
|
||||
python3 -m venv .env
|
||||
. .env/bin/activate
|
||||
|
@ -58,6 +61,15 @@ pip install black bandit pylint flake8 # vscode tooling
|
|||
```
|
||||
|
||||
|
||||
# how to release
|
||||
|
||||
in the `scripts` folder:
|
||||
|
||||
* run `make -C deps-docker` to build all dependencies
|
||||
* create github release with `make-tgz-release.sh`
|
||||
* upload to pypi with `make-pypi-release.(sh|bat)`
|
||||
|
||||
|
||||
# immediate todo
|
||||
|
||||
roughly sorted by priority
|
||||
|
|
|
@ -46,11 +46,11 @@ class HttpConn(object):
|
|||
if self.cert_path:
|
||||
method = self.s.recv(4, socket.MSG_PEEK)
|
||||
if len(method) != 4:
|
||||
err = b"need at least 4 bytes in the first packet; got {}".format(
|
||||
err = "need at least 4 bytes in the first packet; got {}".format(
|
||||
len(method)
|
||||
)
|
||||
self.log(err)
|
||||
self.s.send(b"HTTP/1.1 400 Bad Request\r\n\r\n" + err)
|
||||
self.s.send(b"HTTP/1.1 400 Bad Request\r\n\r\n" + err.encode("utf-8"))
|
||||
return
|
||||
|
||||
if method not in [None, b"GET ", b"HEAD", b"POST"]:
|
||||
|
@ -60,10 +60,18 @@ class HttpConn(object):
|
|||
self.s, server_side=True, certfile=self.cert_path
|
||||
)
|
||||
except Exception as ex:
|
||||
if "ALERT_BAD_CERTIFICATE" in str(ex):
|
||||
em = str(ex)
|
||||
|
||||
if "ALERT_BAD_CERTIFICATE" in em:
|
||||
# firefox-linux if there is no exception yet
|
||||
self.log("client rejected our certificate (nice)")
|
||||
|
||||
elif "ALERT_CERTIFICATE_UNKNOWN" in em:
|
||||
# chrome-android keeps doing this
|
||||
pass
|
||||
|
||||
else:
|
||||
self.log("\033[35mhandshake\033[0m " + str(ex))
|
||||
self.log("\033[35mhandshake\033[0m " + em)
|
||||
|
||||
return
|
||||
|
||||
|
|
Loading…
Reference in a new issue