fix handler function response

This commit is contained in:
yggverse 2024-04-25 14:51:13 +03:00
parent 64a7bc3e2a
commit 27a4dc5bca
2 changed files with 16 additions and 5 deletions

View File

@ -84,7 +84,8 @@ $server->start(
string $content,
string $request,
string $connect
) {
): ?string
{
printf(
'connection: %s request: %s',
$connect,
@ -97,6 +98,8 @@ $server->start(
$content
);
}
return 'thank you!';
}
);
```

View File

@ -185,10 +185,6 @@ class Server
false
);
fclose(
$incoming
);
if ($handler)
{
$response = call_user_func(
@ -198,8 +194,20 @@ class Server
$request,
$connect
);
if ($response)
{
fwrite(
$incoming,
$response
);
}
}
fclose(
$incoming
);
} while ($this->_live);
}