Mercurial > p > roundup > code
diff roundup/cgi/client.py @ 5079:65fef7858606
issue2550826 IOError in detector causes apache 'premature end of script headers' error
Capture all exceptions from auditors/reactors and raise a
DetectorError instead. This allows failures like IOErrors from the
detectors (e.g. unable to access files) to be handled. Previously an
IOError just resulted in no output (premature end of headers under
apache). Problem diagnosed and initial patch created by Tom Ekberg
(tekberg).
Patch application/mods and testing by rouilj.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Fri, 10 Jun 2016 23:33:11 -0400 |
| parents | d0aa596daca8 |
| children | 748ba87e1aca |
line wrap: on
line diff
--- a/roundup/cgi/client.py Fri Jun 10 21:28:40 2016 -0400 +++ b/roundup/cgi/client.py Fri Jun 10 23:33:11 2016 -0400 @@ -19,7 +19,7 @@ from roundup.exceptions import LoginError, Reject, RejectRaw, Unauthorised from roundup.cgi.exceptions import ( FormError, NotFound, NotModified, Redirect, SendFile, SendStaticFile, - SeriousError) + DetectorError, SeriousError) from roundup.cgi.form_parser import FormParser from roundup.mailer import Mailer, MessageSendError, encode_quopri from roundup.cgi import accept_language @@ -572,6 +572,15 @@ # OpenSSL.SSL.SysCallError is similar to IOError above # may happen during write_html and serve_file, too. pass + except DetectorError as e: + if not self.instance.config.WEB_DEBUG: + # run when we are not in debug mode, so errors + # go to admin too. + self.send_error_to_admin(e.subject, e.html, e.txt) + self.write_html(e.html) + else: + # in debug mode, only write error to screen. + self.write_html(e.html) except: # Something has gone badly wrong. Therefore, we should # make sure that the response code indicates failure.
