pythoncgi
Advanced tools
+1
-1
| Metadata-Version: 2.1 | ||
| Name: pythoncgi | ||
| Version: 0.14.0 | ||
| Version: 0.15.0 | ||
| Summary: Extremely simple Python CGI framework for Apache 2. | ||
@@ -5,0 +5,0 @@ Home-page: http://code.foxe6.kozow.com/pythoncgi/ |
@@ -1,2 +0,2 @@ | ||
| __version__ = "0.14.0" | ||
| __version__ = "0.15.0" | ||
| __keywords__ = ["python cgi apache stream file cache server proxy http cors"] | ||
@@ -3,0 +3,0 @@ |
+33
-31
| from omnitools import dt2rfc822gmt, rfc822gmt2dt, b64d_and_utf8d, str2html | ||
| from collections import deque | ||
| import datetime | ||
@@ -147,2 +148,25 @@ import json | ||
| return b.tobytes() | ||
| def read_raw(n): | ||
| nonlocal overread | ||
| nonlocal read | ||
| if overread: | ||
| if len(overread) >= n: | ||
| try: | ||
| return overread[:n].tobytes() | ||
| finally: | ||
| overread = overread[n:] | ||
| if read+n-len(overread) <= length: | ||
| n = n-len(overread) | ||
| else: | ||
| n = length-read | ||
| read += n | ||
| try: | ||
| return overread.tobytes()+body.read(n) | ||
| finally: | ||
| overread = memoryview(b"") | ||
| else: | ||
| if read+n > length: | ||
| n = length-read | ||
| read += n | ||
| return body.read(n) | ||
| def read_file(): | ||
@@ -153,25 +177,2 @@ nonlocal file_read | ||
| file_read = True | ||
| def _read(n=1): | ||
| nonlocal overread | ||
| nonlocal read | ||
| if overread: | ||
| if len(overread) >= n: | ||
| try: | ||
| return overread[:n].tobytes() | ||
| finally: | ||
| overread = overread[n:] | ||
| if read+n-len(overread) <= length: | ||
| n = n-len(overread) | ||
| else: | ||
| n = length-read | ||
| read += n | ||
| try: | ||
| return overread.tobytes()+body.read(n) | ||
| finally: | ||
| overread = memoryview(b"") | ||
| else: | ||
| if read+n > length: | ||
| n = length-read | ||
| read += n | ||
| return body.read(n) | ||
| buffer = b"" | ||
@@ -182,3 +183,3 @@ buffer_ct = 0 | ||
| break | ||
| char = _read(buf) | ||
| char = read_raw(buf) | ||
| try: | ||
@@ -190,3 +191,3 @@ pos = char.index(b"\n") | ||
| mv = None | ||
| except: | ||
| except ValueError: | ||
| pass | ||
@@ -204,3 +205,3 @@ buffer += char | ||
| if len(overread) < len(sig): | ||
| overread = memoryview(overread.tobytes()+_read(len(sig)-len(overread))) | ||
| overread = memoryview(overread.tobytes()+read_raw(len(sig)-len(overread))) | ||
| if overread[:len(sig)].tobytes() == sig: | ||
@@ -224,5 +225,7 @@ overread = overread[len(sig):] | ||
| pos = overread.tobytes().index(b"\n") | ||
| c += overread[:pos+1].tobytes() | ||
| _ = overread[:pos+1].tobytes() | ||
| if not skip: | ||
| c += _ | ||
| overread = overread[pos+1:] | ||
| except: | ||
| except ValueError: | ||
| pass | ||
@@ -254,3 +257,3 @@ while True: | ||
| break | ||
| disposition = dict([_.split("=", 1)[0], _.split("=", 1)[-1][1:-1]] for _ in line.decode().split("; ")[1:]) | ||
| disposition = dict([_.split("=", 1)[0].strip('"'), _.split("=", 1)[-1].strip('"')] for _ in line.decode().split("; ")[1:]) | ||
| if "filename" in disposition: | ||
@@ -273,4 +276,3 @@ skipline() | ||
| if "filename" in disposition and not file_read: | ||
| for _ in disposition["data"]: | ||
| pass | ||
| deque(disposition["data"], maxlen=0) | ||
| file_read = False | ||
@@ -277,0 +279,0 @@ |
+6
-6
@@ -1,4 +0,4 @@ | ||
| pythoncgi/__init__.py,sha256=4tZviXPBxhFi-Jof9lULNgIBUaPZ6F-YF2bWNNxOdJY,838 | ||
| pythoncgi/__init__.py,sha256=1jEDAx-uwIBkkIVX80xlhxFukDPwUxaWqPkaJmm51lo,838 | ||
| pythoncgi/core.py,sha256=KROkjW8NsH4dNNnAjZJp_uGZA8GsZM3Unqx4LQg-rH4,12901 | ||
| pythoncgi/utils.py,sha256=RSNu01FYwkl6MTHJ3T9VUrWXUEHG-XwTWXYmhzplDa4,9428 | ||
| pythoncgi/utils.py,sha256=R-MrAZQ0tIbWwazXD1_VvvpYs5gst-IGXN_BYQ12pNE,9454 | ||
| pythoncgi/__metadata__/DISCLIAIMER.md,sha256=Eh9dhFWbvRMm27jxKYRZqQp_Lb8PkhbYWYQyLoMSrHg,4785 | ||
@@ -19,5 +19,5 @@ pythoncgi/__metadata__/LICENSE,sha256=E_tIpsMacuDitpZQsc6-iVT3tzRJhISS3P0islvZGvo,35182 | ||
| pythoncgi/example/zippyshare_remote_upload.py,sha256=2ZS22-W-L3--uvUQ9rZ4xDWQR6_ITQmG5riLKRWaoK4,2582 | ||
| pythoncgi-0.14.0.dist-info/METADATA,sha256=5gguy5MZHmQg_0zmJuI3XGMKL8s7a22bqQcXq9fyQek,2139 | ||
| pythoncgi-0.14.0.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92 | ||
| pythoncgi-0.14.0.dist-info/top_level.txt,sha256=4FgkqITdsDhqlKxg5Kpy0sWE5NW6U6bXfQFwArs0qPk,10 | ||
| pythoncgi-0.14.0.dist-info/RECORD,, | ||
| pythoncgi-0.15.0.dist-info/METADATA,sha256=a_IpR-1puYM0bhZTaHu7D_WgVHX2_n8_F2D_P1qkCek,2139 | ||
| pythoncgi-0.15.0.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92 | ||
| pythoncgi-0.15.0.dist-info/top_level.txt,sha256=4FgkqITdsDhqlKxg5Kpy0sWE5NW6U6bXfQFwArs0qPk,10 | ||
| pythoncgi-0.15.0.dist-info/RECORD,, |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.