diff options
author | Moshe Zadka <moshez@math.huji.ac.il> | 2000-07-29 05:15:56 +0000 |
---|---|---|
committer | Moshe Zadka <moshez@math.huji.ac.il> | 2000-07-29 05:15:56 +0000 |
commit | ca361d9eb88a2c94e8d25fc08e2eb2acacc6f437 (patch) | |
tree | 9abc1045e08a22045a9b812c9324c1aa222111fa /Lib/SimpleHTTPServer.py | |
parent | e1c405d868cfbafbe564ae9c0ec4039d4d52f5ee (diff) | |
download | cpython-ca361d9eb88a2c94e8d25fc08e2eb2acacc6f437.tar.gz |
Using shutil's function to copy data between file objects instead
of rolling our own.
Note:
This is my first sourceforge checkin. If you see anything funny about
this patch, please let me know.
Diffstat (limited to 'Lib/SimpleHTTPServer.py')
-rw-r--r-- | Lib/SimpleHTTPServer.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Lib/SimpleHTTPServer.py b/Lib/SimpleHTTPServer.py index 7125413120..8a7775856c 100644 --- a/Lib/SimpleHTTPServer.py +++ b/Lib/SimpleHTTPServer.py @@ -15,6 +15,7 @@ import posixpath import BaseHTTPServer import urllib import cgi +import shutil from StringIO import StringIO @@ -151,12 +152,7 @@ class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): to copy binary data as well. """ - - BLOCKSIZE = 8192 - while 1: - data = source.read(BLOCKSIZE) - if not data: break - outputfile.write(data) + shutil.copyfileobj(source, outputfile) def guess_type(self, path): """Guess the type of a file. |