forked from seba/servefile
Code formatting: Whitespace around operators
This commit is contained in:
parent
aa54e8536a
commit
5dcf364e0f
|
@ -108,7 +108,7 @@ class FileBaseHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return (False, None)
|
return (False, None)
|
||||||
|
|
||||||
if fromto[0] >= fileLength or fromto[0] < 0 or fromto[1] >= fileLength or fromto[1]-fromto[0] < 0:
|
if fromto[0] >= fileLength or fromto[0] < 0 or fromto[1] >= fileLength or fromto[1] - fromto[0] < 0:
|
||||||
# oops, already done! (requested range out of range)
|
# oops, already done! (requested range out of range)
|
||||||
self.send_response(416)
|
self.send_response(416)
|
||||||
self.send_header('Content-Range', 'bytes */%d' % fileLength)
|
self.send_header('Content-Range', 'bytes */%d' % fileLength)
|
||||||
|
@ -164,8 +164,8 @@ class FileBaseHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def getChunk(self, myfile, fromto):
|
def getChunk(self, myfile, fromto):
|
||||||
if fromto and myfile.tell()+self.blockSize >= fromto[1]:
|
if fromto and myfile.tell() + self.blockSize >= fromto[1]:
|
||||||
readsize = fromto[1]-myfile.tell()+1
|
readsize = fromto[1] - myfile.tell() + 1
|
||||||
else:
|
else:
|
||||||
readsize = self.blockSize
|
readsize = self.blockSize
|
||||||
return myfile.read(readsize)
|
return myfile.read(readsize)
|
||||||
|
@ -913,7 +913,7 @@ class ServeFile():
|
||||||
# with the same serial ==> we just use the seconds as serial.
|
# with the same serial ==> we just use the seconds as serial.
|
||||||
cert.set_serial_number(int(time.time()))
|
cert.set_serial_number(int(time.time()))
|
||||||
cert.gmtime_adj_notBefore(0)
|
cert.gmtime_adj_notBefore(0)
|
||||||
cert.gmtime_adj_notAfter(365*24*60*60)
|
cert.gmtime_adj_notAfter(365 * 24 * 60 * 60)
|
||||||
cert.set_issuer(req.get_subject())
|
cert.set_issuer(req.get_subject())
|
||||||
cert.set_subject(req.get_subject())
|
cert.set_subject(req.get_subject())
|
||||||
cert.add_extensions([ext])
|
cert.add_extensions([ext])
|
||||||
|
@ -1195,7 +1195,7 @@ def main():
|
||||||
|
|
||||||
if args.auth:
|
if args.auth:
|
||||||
dpos = args.auth.find(":")
|
dpos = args.auth.find(":")
|
||||||
if dpos <= 0 or dpos == (len(args.auth)-1):
|
if dpos <= 0 or dpos == (len(args.auth) - 1):
|
||||||
print("Error: User and password for HTTP basic authentication need to be both "
|
print("Error: User and password for HTTP basic authentication need to be both "
|
||||||
"at least one character and have to be separated by a \":\".")
|
"at least one character and have to be separated by a \":\".")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
Loading…
Reference in New Issue