summaryrefslogtreecommitdiff
path: root/fs/expose
diff options
context:
space:
mode:
authorwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2010-12-18 22:03:19 +0000
committerwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2010-12-18 22:03:19 +0000
commit742ff4a64ffbc4c14c88617fb73d141e5fb723e6 (patch)
tree0aedba537f98e7e3f9196b21d5fc8e0557d80ded /fs/expose
parent9076762bc1454eee99efaae7826bbcd0b03f25cb (diff)
downloadpyfilesystem-git-742ff4a64ffbc4c14c88617fb73d141e5fb723e6.tar.gz
Improved output for fsserve
Diffstat (limited to 'fs/expose')
-rw-r--r--fs/expose/http.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/expose/http.py b/fs/expose/http.py
index 1d4fe50..df296e9 100644
--- a/fs/expose/http.py
+++ b/fs/expose/http.py
@@ -9,6 +9,7 @@ import urllib
import posixpath
import time
import threading
+import socket
def _datetime_to_epoch(d):
return mktime(d.timetuple())
@@ -27,7 +28,10 @@ class FSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
try:
f = self.send_head()
if f:
- self.copyfile(f, self.wfile)
+ try:
+ self.copyfile(f, self.wfile)
+ except socket.error:
+ pass
finally:
if f is not None:
f.close()
@@ -44,8 +48,6 @@ class FSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
"""
path = self.translate_path(self.path)
- #path = self.translate_path(self.path)
- #print path
f = None
if self._fs.isdir(path):
if not self.path.endswith('/'):
@@ -54,7 +56,7 @@ class FSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
self.send_header("Location", self.path + "/")
self.end_headers()
return None
- for index in "index.html", "index.htm":
+ for index in ("index.html", "index.htm"):
index = pathjoin(path, index)
if self._fs.exists(index):
path = index