Makes the outgoing request and relays it to the client, modifying it along the way if necessary
507643
function proxyRequest(data, next) {

        debug('proxying %s %s', data.clientRequest.method, data.url);

        var middlewareHandledRequest = _.some(config.requestMiddleware, function(middleware) {
            middleware(data);
            return data.clientResponse.headersSent; // if true, then _.some will stop processing middleware here because we can no longer
        });

        if (!middlewareHandledRequest) {
            var uri = URL.parse(data.url);

            var options = {
                host: uri.hostname,
                port: uri.port,
                path: uri.path,
                method: data.clientRequest.method,
                headers: data.headers
            };

            //set the agent for the request.
            if(uri.protocol == 'http:' && config.httpAgent) {
              options.agent =  config.httpAgent;
            }
            if(uri.protocol == 'https:' && config.httpsAgent) {
              options.agent =  config.httpsAgent;
            }

            // what protocol to use for outgoing connections.
            var proto = (uri.protocol == 'https:') ? https : http;

            debug('sending remote request: ', options);

            data.remoteRequest = proto.request(options, function(remoteResponse) {
                data.remoteResponse = remoteResponse;
                data.remoteResponse.on('error', next);
                proxyResponse(data);
            });

            data.remoteRequest.on('error', next);

            // pass along POST data & let the remote server know when we're done sending data
            data.stream.pipe(data.remoteRequest);
        }

    }
962335
public void sendRequest (
        int invOid, int invCode, int methodId, Object[] args, Transport transport)
    {
        if (_clobj == null) {
            log.warning("Dropping invocation request on shutdown director", "code", invCode,
                        "methodId", methodId);
            return;
        }

        // configure any invocation listener marshallers among the arguments
        int acount = args.length;
        for (int ii = 0; ii < acount; ii++) {
            Object arg = args[ii];
            if (arg instanceof ListenerMarshaller) {
                ListenerMarshaller lm = (ListenerMarshaller)arg;
                lm.requestId = nextRequestId();
                lm.mapStamp = System.currentTimeMillis();
                // create a mapping for this marshaller so that we can properly dispatch responses
                // sent to it
                _listeners.put(lm.requestId, lm);
            }
        }

        // create an invocation request event
        InvocationRequestEvent event = new InvocationRequestEvent(invOid, invCode, methodId, args);
        event.setTransport(transport);

        // because invocation directors are used on the server, we set the source oid here so that
        // invocation requests are properly attributed to the right client object when created by
        // server-side entities only sort of pretending to be a client
        event.setSourceOid(_clobj.getOid());

//         Log.info("Sending invreq " + event + ".");

        // now dispatch the event
        _omgr.postEvent(event);
    }
500387
function Communication() {
		// setup abstract layer
		core.CommunicationAbstract.apply(this, arguments);

		// just relay message object they do not need to be parsed
		this.object.on('message', this.emit.bind(this, 'message'));

		// when the remote request a method, the methods should exists in .handlers
		var self = this;
		this.handlers.close = function () {
			this.callback();
			self.emit('close');
		};
	}
1128812
function OutgoingResponse(stream) {
  OutgoingMessage.call(this);

  this._log = stream._log.child({ component: 'http' });

  this.stream = stream;
  this.statusCode = 200;
  this.sendDate = true;

  this.stream.once('headers', this._onRequestHeaders.bind(this));
}
455855
def _process_outgoing_msg(self, sink_iter):
        
        LOG.debug('NetworkController processing outgoing request list.')
        # TODO(PH): We should try not to sent routes from bgp peer that is not
        # in established state.
        from ryu.services.protocols.bgp.model import (
            FlexinetOutgoingRoute)
        while self.is_connected:
            # sink iter is Sink instance and next is blocking so this isn't
            # active wait.
            for outgoing_msg in sink_iter:
                if not self.is_connected:
                    self._socket.close()
                    return
                if isinstance(outgoing_msg, FlexinetOutgoingRoute):
                    rpc_msg = _create_prefix_notification(outgoing_msg, self)
                else:
                    raise NotImplementedError(
                        'Do not handle out going message of type %s' %
                        outgoing_msg.__class__)
                if rpc_msg:
                    self._sendall(rpc_msg)
            self.pause(0)

        # Stop incoming connection.
        if self.green_in:
            self.green_in.kill()
429193
def _request(request, request_fallback=None):
        '''  '''
        # Use lambdas to avoid evaluating bottle.request.* which may throw an Error
        all_dicts = [
            lambda: request.json,
            lambda: request.forms,
            lambda: request.query,
            lambda: request.files,
            #lambda: request.POST,
            lambda: request_fallback
        ]
        request_dict = dict()
        for req_dict_ in all_dicts:
            try:
                req_dict = req_dict_()
            except KeyError:
                continue
            if req_dict is not None and hasattr(req_dict, 'items'):
                for req_key, req_val in req_dict.items():
                    request_dict[req_key] = req_val
        return request_dict
1073713
def send_request(self, request):
        
        if request.observe == 0:
            # Observe request
            host, port = request.destination
            key_token = hash(str(host) + str(port) + str(request.token))

            self._relations[key_token] = ObserveItem(time.time(), None, True, None)

        return request
1078585
function request(ipc, name, args) {

		// check online
		if (!ipc.root.online) {
			ipc.root.emit('error', new Error("Could not make a request, channel is offline"));
			return;
		}

		// store callback for later
		var callback = args.pop();

		// check that a callback is set
		if (typeof callback !== 'function') {
			ipc.root.emit('error', new TypeError("No callback specified"));
			return;
		}

		// send request to remote
		ipc.send('call', [name, args], function (sucess, content) {
			if (sucess) {
				callback.apply({
					error: null
				}, content);
			} else {
				callback.apply({
					error: helpers.object2error(content)
				}, []);
			}
		});
	}
656283
function sendRequest()
  {
    // if this is a retry and a query parameter should be appended to the url on
    // retry, update the url
    if ((numRetries > 0) && appendQueryParamOnRetry)
    {
      options.url = Util.url.appendParam(urlOrig, 'retry', true);
    }

    sf.request(options);
  }
841290
protected void receiveServerRequest(HttpMessage request) {
        BuilderSupport<HttpActionBuilder> action = builder -> {
            HttpServerActionBuilder.HttpServerReceiveActionBuilder receiveBuilder = builder.server(httpServer).receive();
            HttpServerRequestActionBuilder requestBuilder;

            if (request.getRequestMethod() == null || request.getRequestMethod().equals(HttpMethod.POST)) {
                requestBuilder = receiveBuilder.post().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.GET)) {
                requestBuilder = receiveBuilder.get().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.PUT)) {
                requestBuilder = receiveBuilder.put().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.DELETE)) {
                requestBuilder = receiveBuilder.delete().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.HEAD)) {
                requestBuilder = receiveBuilder.head().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.TRACE)) {
                requestBuilder = receiveBuilder.trace().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.PATCH)) {
                requestBuilder = receiveBuilder.patch().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.OPTIONS)) {
                requestBuilder = receiveBuilder.options().message(request);
            } else {
                requestBuilder = receiveBuilder.post().message(request);
            }

            for (Map.Entry<String, String> headerEntry : pathValidations.entrySet()) {
                requestBuilder.validate(headerEntry.getKey(), headerEntry.getValue());
            }
            pathValidations.clear();
        };

        runner.http(action);
    }
94184
def make_request(self, method, path, headers=None, data='', host=None,
                     auth_path=None, sender=None, override_num_retries=None):
        """"""
        http_request = self.build_base_http_request(method, path, auth_path,
                                                    {}, headers, data, host)
        return self._mexe(http_request, sender, override_num_retries)
510859
def process_request(self, req, resp):  # pylint: disable=unused-argument
        

        if req.path in (self.revoke_endpoint, self.token_endpoint):
            return

        try:
            token = self._get_token(req)
            self.auth_token(token)
        except (AuthRequired, InvalidAuthSyntax) as exc:
            if not self.optional:
                abort(exc)
        except AuthRejected as exc:
            if not self.optional:
                exc.headers = self._get_invalid_token_headers(exc.detail)
                abort(exc)
265003
def request(self, method, args, response_cb):
        
        request_id = self._next_request_id
        self._next_request_id = request_id + 1
        self._msgpack_stream.send([0, request_id, method, args])
        self._pending_requests[request_id] = response_cb
446869
def process_request(control, sym, args)
      instance = factory.call(control)

      instance.send(sym, *args)
    end
690323
function RequestWrapper(req) {
  this.request = req;
  this.method = req.method;
  this.url = req.url;
  this.body = req._data;
  this.headers = req._header;
}
1204563
def send_request(ref, msg_id, arg, b)
      @msg.send_request(stream, ref, msg_id, arg, b)
    end
1340043
def process_request(self, request):
        
        # Initialize thread local storage
        threadlocal.auditlog = {
            'signal_duid': (self.__class__, time.time()),
            'remote_addr': request.META.get('REMOTE_ADDR'),
        }

        # In case of proxy, set 'original' address
        if request.META.get('HTTP_X_FORWARDED_FOR'):
            threadlocal.auditlog['remote_addr'] = request.META.get('HTTP_X_FORWARDED_FOR').split(',')[0]

        # Connect signal for automatic logging
        if hasattr(request, 'user') and is_authenticated(request.user):
            set_actor = curry(self.set_actor, user=request.user, signal_duid=threadlocal.auditlog['signal_duid'])
            pre_save.connect(set_actor, sender=LogEntry, dispatch_uid=threadlocal.auditlog['signal_duid'], weak=False)