mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
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.
This commit is contained in:
parent
10853c9835
commit
37c03ff3a9
1 changed files with 2 additions and 6 deletions
|
@ -15,6 +15,7 @@ import posixpath
|
||||||
import BaseHTTPServer
|
import BaseHTTPServer
|
||||||
import urllib
|
import urllib
|
||||||
import cgi
|
import cgi
|
||||||
|
import shutil
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,12 +152,7 @@ class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||||
to copy binary data as well.
|
to copy binary data as well.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
shutil.copyfileobj(source, outputfile)
|
||||||
BLOCKSIZE = 8192
|
|
||||||
while 1:
|
|
||||||
data = source.read(BLOCKSIZE)
|
|
||||||
if not data: break
|
|
||||||
outputfile.write(data)
|
|
||||||
|
|
||||||
def guess_type(self, path):
|
def guess_type(self, path):
|
||||||
"""Guess the type of a file.
|
"""Guess the type of a file.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue