Skip to content

Fix GH-11146: the use of SSE in the built-in webserver #11147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

Yurunsoft
Copy link
Contributor

fix #11146

@Yurunsoft Yurunsoft requested a review from bukka as a code owner April 28, 2023 08:32
@Yurunsoft Yurunsoft closed this Apr 28, 2023
@Yurunsoft Yurunsoft deleted the fix-event-stream branch April 28, 2023 09:08
Copy link
Member

@bukka bukka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As commented on the issue, the change makes sense but needs to be more generic.

@@ -371,7 +371,7 @@ SAPI_API size_t sapi_apply_default_charset(char **mimetype, size_t len)
charset = SG(default_charset) ? SG(default_charset) : SAPI_DEFAULT_CHARSET;

if (*mimetype != NULL) {
if (*charset && strncmp(*mimetype, "text/", 5) == 0 && strstr(*mimetype, "charset=") == NULL) {
if (*charset && strncmp(*mimetype, "text/", 5) == 0 && strstr(*mimetype, "charset=") == NULL && strcmp(*mimetype, "text/event-stream") != 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be more generic so we can use it for other subtypes that could be added as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also start comparisons from subtype as text/ is already checked...

$host = PHP_CLI_SERVER_HOSTNAME;

$fp = php_cli_server_connect();
if(fwrite($fp, <<<HEADER
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice if you could define heredoc outside if to be more readable. Also there should be a space after if

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SAPI should not add charset to each text subtype
2 participants