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

View File

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