Lines Matching defs:request
26 public function __invoke(array $request)
28 $url = Core::url($request);
29 Core::doSleep($request);
33 $request = Core::removeHeader($request, 'Expect');
34 $stream = $this->createStream($url, $request);
35 return $this->createResponse($request, $url, $stream);
41 private function createResponse(array $request, $url, $stream)
54 $stream = $this->checkDecode($request, $response, $stream);
57 if (empty($request['client']['stream'])) {
58 $dest = isset($request['client']['save_to'])
59 ? $request['client']['save_to']
69 private function checkDecode(array $request, array $response, $stream)
72 if (!empty($request['client']['decode_content'])) {
183 private function createStream($url, array $request)
192 if ((!isset($request['version']) || $request['version'] == '1.1')
193 && !Core::hasHeader($request, 'Connection')
195 $request['headers']['Connection'] = ['close'];
199 if (!isset($request['client']['verify'])) {
200 $request['client']['verify'] = true;
204 $options = $this->getDefaultOptions($request);
206 if (isset($request['client'])) {
207 foreach ($request['client'] as $key => $value) {
210 $this->{$method}($request, $options, $value, $params);
217 $request,
219 $this->createContext($request, $options, $params)
223 private function getDefaultOptions(array $request)
226 foreach ($request['headers'] as $name => $value) {
234 'method' => $request['http_method'],
236 'protocol_version' => isset($request['version']) ? $request['version'] : 1.1,
242 $body = Core::body($request);
246 if (!Core::hasHeader($request, 'Content-Type')) {
256 private function add_proxy(array $request, &$options, $value, &$params)
261 $scheme = isset($request['scheme']) ? $request['scheme'] : 'http';
268 private function add_timeout(array $request, &$options, $value, &$params)
273 private function add_verify(array $request, &$options, $value, &$params)
291 throw new RingException('Invalid verify request option');
298 private function add_cert(array $request, &$options, $value, &$params)
312 private function add_progress(array $request, &$options, $value, &$params)
326 private function add_debug(array $request, &$options, $value, &$params)
349 $ident = $request['http_method'] . ' ' . Core::url($request);
366 private function applyCustomOptions(array $request, array &$options)
368 if (!isset($request['client']['stream_context'])) {
372 if (!is_array($request['client']['stream_context'])) {
378 $request['client']['stream_context']
382 private function createContext(array $request, array $options, array $params)
384 $this->applyCustomOptions($request, $options);
386 function () use ($request, $options, $params) {
389 $request,
396 array $request,
410 $request,