summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Saddi <allan@saddi.com>2011-01-11 10:43:06 -0800
committerAllan Saddi <allan@saddi.com>2011-01-11 10:43:06 -0800
commitf866035b7c02527b83850cf841d5a78b106ab85e (patch)
tree15a02c0d3c396b5d564aa9005021261ec81c506e
parentcf83bcc17729260343b1a155e8e2876c62f7b80a (diff)
downloadflup-f866035b7c02527b83850cf841d5a78b106ab85e.tar.gz
Use HTTP status code 500 for error pages.
-rw-r--r--ChangeLog5
-rw-r--r--flup/server/ajp_base.py6
-rw-r--r--flup/server/fcgi_base.py6
-rw-r--r--flup/server/scgi_base.py6
4 files changed, 17 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 540403a..5993dc2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-11 Allan Saddi <allan@saddi.com>
+
+ * Use HTTP status code 500 for error pages. Thanks to
+ Yohann Gabory for pointing out this issue and providing a patch.
+
2010-10-14 Allan Saddi <allan@saddi.com>
* Don't try to restore signal handlers if they weren't installed in
diff --git a/flup/server/ajp_base.py b/flup/server/ajp_base.py
index 7f622fc..52c003d 100644
--- a/flup/server/ajp_base.py
+++ b/flup/server/ajp_base.py
@@ -960,7 +960,8 @@ class BaseAJPServer(object):
all errors should be caught at the application level.
"""
if self.debug:
- request.startResponse(200, 'OK', [('Content-Type', 'text/html')])
+ request.startResponse(500, 'Internal Server Error',
+ [('Content-Type', 'text/html')])
import cgitb
request.write(cgitb.html(sys.exc_info()))
else:
@@ -972,5 +973,6 @@ class BaseAJPServer(object):
<p>An unhandled exception was thrown by the application.</p>
</body></html>
"""
- request.startResponse(200, 'OK', [('Content-Type', 'text/html')])
+ request.startResponse(500, 'Internal Server Error',
+ [('Content-Type', 'text/html')])
request.write(errorpage)
diff --git a/flup/server/fcgi_base.py b/flup/server/fcgi_base.py
index 9b976c8..f4b9753 100644
--- a/flup/server/fcgi_base.py
+++ b/flup/server/fcgi_base.py
@@ -1214,7 +1214,8 @@ class BaseFCGIServer(object):
"""
if self.debug:
import cgitb
- req.stdout.write('Content-Type: text/html\r\n\r\n' +
+ req.stdout.write('Status: 500 Internal Server Error\r\n' +
+ 'Content-Type: text/html\r\n\r\n' +
cgitb.html(sys.exc_info()))
else:
errorpage = """<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
@@ -1225,5 +1226,6 @@ class BaseFCGIServer(object):
<p>An unhandled exception was thrown by the application.</p>
</body></html>
"""
- req.stdout.write('Content-Type: text/html\r\n\r\n' +
+ req.stdout.write('Status: 500 Internal Server Error\r\n' +
+ 'Content-Type: text/html\r\n\r\n' +
errorpage)
diff --git a/flup/server/scgi_base.py b/flup/server/scgi_base.py
index f941deb..199f82b 100644
--- a/flup/server/scgi_base.py
+++ b/flup/server/scgi_base.py
@@ -550,7 +550,8 @@ class BaseSCGIServer(object):
"""
if self.debug:
import cgitb
- request.stdout.write('Content-Type: text/html\r\n\r\n' +
+ request.stdout.write('Status: 500 Internal Server Error\r\n' +
+ 'Content-Type: text/html\r\n\r\n' +
cgitb.html(sys.exc_info()))
else:
errorpage = """<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
@@ -561,5 +562,6 @@ class BaseSCGIServer(object):
<p>An unhandled exception was thrown by the application.</p>
</body></html>
"""
- request.stdout.write('Content-Type: text/html\r\n\r\n' +
+ request.stdout.write('Status: 500 Internal Server Error\r\n' +
+ 'Content-Type: text/html\r\n\r\n' +
errorpage)