if ($return->
is_redirect() &&
$options['follow_redirects'
] === true
) { if (isset($return->headers
['location'
]) &&
$options['redirected'
] <
$options['redirects'
]) { if ($return->status_code === 303
) { $options['type'
] = self::GET;
} $options['redirected'
]++;
$location =
$return->headers
['location'
];
if (strpos($location, 'http://'
) !== 0 &&
strpos($location, 'https://'
) !== 0
) { // relative redirect, for compatibility make it absolute
$location = Iri::
absolutize($url,
$location);
$location =
$location->uri;
} $hook_args =
[ &
$location,
&
$req_headers,
&
$req_data,
&
$options,
$return,
];
$options['hooks'
]->
dispatch('requests.before_redirect',
$hook_args);