Skip to content

Commit 462685a

Browse files
committed
Merge pull request #18 from w3c/jgraham/close_asis
Also close the connection for asis files.
2 parents d73b6cd + 44fe434 commit 462685a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

wptserve/handlers.py

+1
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ def as_is_handler(request, response):
220220
try:
221221
with open(path) as f:
222222
response.writer.write_content(f.read())
223+
response.close_connection = True
223224
except IOError:
224225
raise HTTPException(404)
225226

wptserve/server.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,13 @@ def handle_one_request(self):
218218
request.request_path, request.headers.get('Referer'), request.raw_input.length))
219219
if not response.writer.content_written:
220220
response.write()
221-
# If we want to remove this in the future, a solution is needed for
222-
# scripts that produce a non-string iterable of content, since these
223-
# can't set a Content-Length header. A notable example of this kind of
224-
# problem is with the trickle pipe i.e. foo.js?pipe=trickle(d1)
225-
if response.close_connection:
226-
self.close_connection = 1
221+
222+
# If we want to remove this in the future, a solution is needed for
223+
# scripts that produce a non-string iterable of content, since these
224+
# can't set a Content-Length header. A notable example of this kind of
225+
# problem is with the trickle pipe i.e. foo.js?pipe=trickle(d1)
226+
if response.close_connection:
227+
self.close_connection = 1
227228

228229
except socket.timeout, e:
229230
self.log_error("Request timed out: %r", e)

0 commit comments

Comments
 (0)