httpd: log bugs with stacktrace

Log a stack-trace and return appropriate HTTP response status code if
a bug is detected.

Target: master
Patch: http://rb.dcache.org/r/6973/
Acked-by: Tigran Mkrtchyan