mirror of
https://github.com/moparisthebest/HttpUploadComponent
synced 2024-11-21 16:35:04 -05:00
fixed small files not working
This commit is contained in:
parent
7f6be7e97a
commit
96b39250b2
@ -104,7 +104,7 @@ class HttpHandler(BaseHTTPRequestHandler):
|
|||||||
os.makedirs(os.path.dirname(filename))
|
os.makedirs(os.path.dirname(filename))
|
||||||
remaining = length
|
remaining = length
|
||||||
f = open(filename,'wb')
|
f = open(filename,'wb')
|
||||||
data = self.rfile.read(4096)
|
data = self.rfile.read(min(4096,remaining))
|
||||||
while data and remaining >= 0:
|
while data and remaining >= 0:
|
||||||
remaining -= len(data)
|
remaining -= len(data)
|
||||||
f.write(data)
|
f.write(data)
|
||||||
@ -169,8 +169,8 @@ if __name__ == "__main__":
|
|||||||
global config
|
global config
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("-c", "--config", type=unicode, default='config.yml', help='Specify alternate config file.')
|
parser.add_argument("-c", "--config", default='config.yml', help='Specify alternate config file.')
|
||||||
parser.add_argument("-l", "--logfile", type=unicode, default=None, help='File where the server log will be stored. If not specified log to stdout.')
|
parser.add_argument("-l", "--logfile", default=None, help='File where the server log will be stored. If not specified log to stdout.')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
with open(args.config,'r') as ymlfile:
|
with open(args.config,'r') as ymlfile:
|
||||||
|
Loading…
Reference in New Issue
Block a user