improve the capture_exception utility.

Now restricted exception types is supported.
process multiple kinds of transfer encoding.