foreach ($options['headers'
] as $v) { $h =
explode(': ',
$v, 2
);
$request->
addHeader($h[0
],
$h[1
]);
} $request->
setTcpConnectTimeout(1000 *
$options['timeout'
]);
$request->
setTlsHandshakeTimeout(1000 *
$options['timeout'
]);
$request->
setTransferTimeout(1000 *
$options['max_duration'
]);
if (method_exists($request, 'setInactivityTimeout'
)) { $request->
setInactivityTimeout(0
);
} if ('' !==
$request->
getUri()->
getUserInfo() && !
$request->
hasHeader('authorization'
)) { $auth =
explode(':',
$request->
getUri()->
getUserInfo(), 2
);
$auth =
array_map('rawurldecode',
$auth) +
[1 => ''
];
$request->
setHeader('Authorization', 'Basic '.
base64_encode(implode(':',
$auth)));
} return new AmpResponse($this->multi,
$request,
$options,
$this->logger
);
}