Common code for GET and POST requests

def common_req(self, execute, send_body=True):
        "Common code for GET and POST requests"
        self._SERVER            = {'CLIENT_ADDR_HOST': self.client_address[0],
                                   'CLIENT_ADDR_PORT': self.client_address[1]}

        self._to_log            = True
        self._cmd               = None

        self._payload           = None
        self._path              = None
        self._payload_params    = None
        self._query_params      = {}
        self._fragment          = None

        (cmd, res, req)         = (None, None, None)

        try:
            try:
                path    = self._pathify() # pylint: disable-msg=W0612
                cmd     = path[1:]
                res     = execute(cmd)
            except HttpReqError, e:
                e.report(self)
            except Exception:
                try:
                    self.send_exception(500) # XXX 500
                except Exception: # pylint: disable-msg=W0703
                    pass
                raise
            else:
                if not isinstance(res, HttpResponse):
                    req = self.build_response()
                    if send_body:
                        req.add_data(res)
                    req.set_send_body(send_body)
                else:
                    req = res

                self.end_response(req)
        except socket.error, e:
            if e.errno in (errno.ECONNRESET, errno.EPIPE):
                return
            LOG.exception("exception - cmd=%r - method=%r", cmd, self.command)
        except Exception: # pylint: disable-msg=W0703
            LOG.exception("exception - cmd=%r - method=%r", cmd, self.command)
        finally:
            del req, res