Skip to content
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

Fix content length when using response body callbacks #572

Merged
merged 2 commits into from
Apr 11, 2024

Conversation

BelleNottelling
Copy link
Contributor

#571 introduced an issue where the response body could be modified after Flight calculates & sends the content length to the browser. Since the response body callback modifies the body, the content length is no longer correct.

In my testing things seemed to still work okay locally with the PHP dev server, but once I moved to an actual server I noticed the browser would sit and continue to try to load after the body has already sent as the response body was compressed after the content length was sent.

Switching the order so the callback is called and then headers are sent fixes this

@n0nag0n
Copy link
Collaborator

n0nag0n commented Apr 11, 2024

Want to give my changes a go real quick to make sure I didn't mess up anything on your end?

@BelleNottelling
Copy link
Contributor Author

Want to give my changes a go real quick to make sure I didn't mess up anything on your end?

Still works as expected on my end, thanks for checking

@n0nag0n n0nag0n merged commit 0011efd into flightphp:master Apr 11, 2024
@BelleNottelling BelleNottelling deleted the fix/output-compression branch April 11, 2024 04:29
@n0nag0n
Copy link
Collaborator

n0nag0n commented Apr 11, 2024

Merged and released as v3.8.1. Thanks for the assist!

@BelleNottelling
Copy link
Contributor Author

Thanks for getting this merged and releasing the fix!

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

Successfully merging this pull request may close these issues.

2 participants