Use httputil error functions for client errors

This should provide more consistent and complete error messages with
less code.