Skip to content

Commit

Permalink
update to 0.7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
RaSan147 committed Mar 17, 2023
1 parent 00c6920 commit 8d1b458
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Version 0.7.1 - 0.7.3
## Client-side Changes:
* Nothing to notice
## Server-side Changes:
* Nothing to notice
## Fixes:
* Fixed "send_txt" function not working



# Version 0.7.0
## Client-side Changes:
* Video plater page shows title of video
Expand Down
2 changes: 1 addition & 1 deletion dev_src/html_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@

.link_name {
width: calc(100% - 57px);

}


Expand Down
7 changes: 4 additions & 3 deletions dev_src/local_server_pyrobox.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
__version__ = "0.7.0"
enc = "utf-8"

import html
Expand Down Expand Up @@ -31,9 +30,9 @@
import traceback
import atexit

from pyroboxCore import config, logger, SimpleHTTPRequestHandler as SH, DealPostData as DPD, run as run_server, tools, Callable_dict, reload_server

from pyroboxCore import config, logger, SimpleHTTPRequestHandler as SH, DealPostData as DPD, run as run_server, tools, Callable_dict, reload_server, __version__

__version__ = __version__
true = T = True
false = F = False

Expand All @@ -47,6 +46,8 @@
args = config.parser.parse_known_args()[0]
config.PASSWORD = args.password

config.MAIN_FILE = os.path.abspath(__file__)

config.disabled_func.update({
"send2trash": False,
"natsort": False,
Expand Down
6 changes: 4 additions & 2 deletions dev_src/pyroboxCore.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.7.0"
__version__ = "0.7.3"
enc = "utf-8"
__all__ = [
"HTTPServer", "ThreadingHTTPServer", "BaseHTTPRequestHandler",
Expand Down Expand Up @@ -398,6 +398,7 @@ def URL_MANAGER(url:str):
<p>Error code: %(code)d</p>
<p>Message: %(message)s.</p>
<p>Error code explanation: %(code)s - %(explain)s.</p>
<h3>PyroBox Version: %(version)s
</body>
</html>
"""
Expand Down Expand Up @@ -720,7 +721,8 @@ def send_error(self, code, message=None, explain=None):
content = (self.error_message_format % {
'code': code,
'message': html.escape(message, quote=False),
'explain': html.escape(explain, quote=False)
'explain': html.escape(explain, quote=False),
'version': __version__
})
body = content.encode('UTF-8', 'replace')
self.send_header("Content-Type", self.error_content_type)
Expand Down
20 changes: 9 additions & 11 deletions src/pyroboxCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,6 @@ class DealPostData:

boundary = b''
num = 0
blank = 0 # blank is used to check if the post is empty or Connection Aborted
remainbytes = 0

def __init__(self, req:SimpleHTTPRequestHandler) -> None:
Expand All @@ -1457,25 +1456,24 @@ def __init__(self, req:SimpleHTTPRequestHandler) -> None:
refresh = "<br><br><div class='pagination center' onclick='window.location.reload()'>Refresh &#128259;</div>"


def get(self, show=F, strip=F):
def get(self, show=F, strip=F, Timeout=20):
"""
show: print line
strip: strip \r\n at end
Timeout: if having network issue on any side, will keep trying to get content until Timeout (in seconds)
"""
req = self.req
line = req.rfile.readline()


if line == b'':
self.blank += 1
for _ in range(Timeout*2):
line = req.rfile.readline()
if line:
break
time.sleep(.5)
else:
self.blank = 0
if self.blank>=20: # allow 20 loss packets
req.send_error(408, "Request Timeout")
time.sleep(1) # wait for the client to close the connection

raise ConnectionAbortedError
self.num+=1
if show:
self.num+=1
print(f"{self.num}: {line}")
self.remainbytes -= len(line)

Expand Down

0 comments on commit 8d1b458

Please sign in to comment.