doc: improved the code examples in Synopsis

* added proper error handling code for request_uri(), request(), and
  set_keepalive() calls to help trouble-shooting.
* added the "resolver" directive for the example with domain names.
* removed line-trailing spaces.