respond client and close request
979022
function (obj, meta, status = 200, errorCode = -1, devMsg = null, usrMsg = null, moreInfo = null) {
      if (res.finished) {
        // request ended
        return
      }

      // ref.: https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
      if (status < 300) {
        // OK
        // 
        let body
        switch (typeof obj) {
          case 'object':
            // expected
            if (meta) {
              res.setHeader('X-Metadata', 'true')
              body = JSON.stringify({ 'meta': meta, 'result': obj })
            } else {
              body = JSON.stringify(obj)
            }
            break

          case 'string':
          case 'number':
            // maybe an ID returned after modification request
            body = JSON.stringify({ 'result': obj })
            break

          default:
            // return null JSON object
            body = '{}'
        }

        if (verb === 'GET') {
          // ETag to verify browser cache validation
          // have to be set here, web servers will not etag proxy requests
          // Cloudflare keep only weak ETags
          res.setHeader('ETag', etag(body, { 'weak': true }))
        }
        res.writeHead(status)
        res.end(body)
      } else if (status < 400 && typeof obj === 'string') {
        // redirect
        // expect obj to be the redirect URL
        // return object with previous and next (after redirect) URL
        let response = {
          'status': status,
          'requested_url': req.url,
          'endpoint': obj
        }
        // explain type of redirect in message
        if (status === 301) {
          response.message = 'Moved permanently, please re-send this request to the specified endpoint'
        } else {
          response.message = 'Temporary redirect, re-send this request to the specified temporary endpoint, ' +
            'continue to use the original request endpoint for future requests'
        }

        res.writeHead(status, { 'Location': obj })
        res.end(JSON.stringify(response))
      } else if (typeof obj === 'object' && obj !== null && Object.keys(obj).length > 0) {
        // custom error object
        res.writeHead(status)
        res.end(JSON.stringify(obj))
      } else {
        // client and/or server error
        httpErrorHandling(res, status, errorCode, devMsg, usrMsg, moreInfo)
      }
    }
775860
def process_request_thread(self, request, client_address):
    """"""
    # Instantiate the request handler.
    handler = self.RequestHandlerClass(request, client_address, self)
    try:
      # Attempt to handle a request with the handler.
      handler.handle_request()
      self.request_complete_callback()

    except Exception as e:
      # If that fails, (synchronously) handle the error with the error handler sans-fork.
      try:
        handler.handle_error(e)
      finally:
        # Shutdown the socket since we don't expect a fork() in the exception context.
        self.shutdown_request(request)
    else:
      # At this point, we expect a fork() has taken place - the parent side will return, and so we
      # close the request here from the parent without explicitly shutting down the socket. The
      # child half of this will perform an os._exit() before it gets to this point and is also
      # responsible for shutdown and closing of the socket when its execution is complete.
      self.close_request(request)
1267182
async def _request(self, method, url, loop=None, timeout=None, **kwargs):
        """"""
        session = self.session or aiohttp.ClientSession(
            loop=loop, conn_timeout=timeout, read_timeout=timeout)
        try:
            async with session.request(method, url, **kwargs) as response:

                if response.status / 100 > 2:
                    raise web.HTTPBadRequest(
                        reason='HTTP status code: %s' % response.status)

                if 'json' in response.headers.get('CONTENT-TYPE'):
                    data = await response.json()
                else:
                    data = await response.text()
                    data = dict(parse_qsl(data))

                return data

        except asyncio.TimeoutError:
            raise web.HTTPBadRequest(reason='HTTP Timeout')

        finally:
            if not self.session and not session.closed:
                await session.close()
430981
function(callback) {

      // Detect server errors
      var t = this, server = t.get('server');
      server.on('clientError', function(err){
        console.error('Client error detected on server', err);
        t.trigger('error', err);
      });
      server.on('close', function(err){
        server.hasEmittedClose = true;
        t.stop();
      });

      // Notify that we've started
      t.isListening = true;
      if (callback) {
        callback(null);
      }
      t.trigger('start');
    }
278251
def process_request_thread(self, request, client_address):
        
        try:
            self.finish_request(request, client_address)
            self.shutdown_request(request)
        except:
            self.handle_error(request, client_address)
            self.shutdown_request(request)
11481
def handle(self):
        """"""
        self.close_connection = 1

        self.handle_one_request()
        while not self.close_connection:
            self.handle_one_request()
926145
public void close() throws IOException {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Closing client for session: 0x"
                    + Long.toHexString(getSessionId()));
        }

        try {
            RequestHeader h = new RequestHeader();
            h.setType(ZooDefs.OpCode.closeSession);

            submitRequest(h, null, null, null);
        } catch (InterruptedException e) {
            // ignore, close the send/event threads
        } finally {
            disconnect();
        }
    }
607620
def quit(self):
    """"""
    try:
      # Don't expect a response.
      self._client.write(sc_pb.Request(quit=sc_pb.RequestQuit()))
    except protocol.ConnectionError:
      pass  # It's likely already (shutting) down, so continue as if it worked.
    finally:
      self.close()
789885
def database_close(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/close' % object_id, input_params, always_retry=always_retry, **kwargs)
687788
def process_request(self, request, client_address):
        

        self.finish_request(request, client_address)
        self.shutdown_request(request)
185838
def close(self, response):
        """"""
        LOGGER.info('Closing [%s]', os.getpid())
        if not self.database.is_closed():
            self.database.close()
        return response
1272642
def close(self):
        
        if hasattr(self.response, "close"):
            self.response.close()
        for func in self._on_close:
            func()
1094304
def close(self, request, *args, **kwargs):
        
        if not request.user.is_staff:
            raise PermissionDenied()
        alert = self.get_object()
        alert.close()

        return response.Response(status=status.HTTP_204_NO_CONTENT)
549894
function(request, callback, response_middlewares) {
        var that = this;
        request.finalize(function(err, res) {
            if (err) callback(err, null);
            else that._callResponseMiddlewares(response_middlewares, res, callback);
        });
    }
297118
def _close_app(app, mongo_client, client):
    
    app.stop()
    client.close()
    mongo_client.close()
1101007
@Override
  public void onTimeout()
  {
    try {
      //request().sendError(WebRequest.INTERNAL_SERVER_ERROR);
      if (true) throw new UnsupportedOperationException();
    } catch (Exception e) {
      log.log(Level.FINEST, e.toString(), e);
    }
    
    closeResponse();
  }
716394
public void alertClose() {
        if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  
            logger.logp(Level.FINE, CLASS_NAME,"alertClose()", "");
        }
        if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
            checkRequestObjectInUse();
        }
        _srtRequestHelper._InputStreamClosed=true;
    }