|
|
@ -367,7 +367,8 @@ class Page |
|
|
|
|
|
|
|
|
|
|
|
private function _gemini( |
|
|
|
private function _gemini( |
|
|
|
string $url, |
|
|
|
string $url, |
|
|
|
int $code = 0 |
|
|
|
int $code = 0, |
|
|
|
|
|
|
|
int $redirects = 0 |
|
|
|
): void |
|
|
|
): void |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Track response time |
|
|
|
// Track response time |
|
|
@ -423,8 +424,19 @@ class Page |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// Process redirect |
|
|
|
// Process redirect |
|
|
|
if ($this->config->redirect->follow->enabled && in_array($response->getCode(), $this->config->redirect->follow->code)) |
|
|
|
if (in_array($response->getCode(), $this->config->redirect->follow->code)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if ($this->config->redirect->follow->enabled) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if ($redirects > $this->config->redirect->follow->max) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
$this->_yoda( |
|
|
|
|
|
|
|
'yoda://redirect' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$redirect = new \Yggverse\Net\Address( |
|
|
|
$redirect = new \Yggverse\Net\Address( |
|
|
|
$url |
|
|
|
$url |
|
|
|
); |
|
|
|
); |
|
|
@ -436,12 +448,23 @@ class Page |
|
|
|
$this->open( |
|
|
|
$this->open( |
|
|
|
$redirect->get(), |
|
|
|
$redirect->get(), |
|
|
|
false, |
|
|
|
false, |
|
|
|
$response->getCode() |
|
|
|
$response->getCode(), |
|
|
|
|
|
|
|
$redirects + 1 |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$this->_yoda( |
|
|
|
|
|
|
|
'yoda://redirect' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$this->content->set_markup( |
|
|
|
$this->content->set_markup( |
|
|
|
\Yggverse\Gemini\Pango::fromGemtext( |
|
|
|
\Yggverse\Gemini\Pango::fromGemtext( |
|
|
|
$response->getBody() |
|
|
|
$response->getBody() |
|
|
|