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

Support for "Early Hints" / HTTP Code 103 #253

Open
joergmoenke opened this issue Nov 15, 2023 · 1 comment
Open

Support for "Early Hints" / HTTP Code 103 #253

joergmoenke opened this issue Nov 15, 2023 · 1 comment

Comments

@joergmoenke
Copy link

I tried, but i could not get it to work with this library: Is it possible to do things like sending 2 responses as server response?

// init - RoadRunner is just an example
$worker     = \Spiral\RoadRunner\Worker::create();
$psrFactory = new Psr17Factory();
$psr7   = new \Spiral\RoadRunner\Http\PSR7Worker(worker        : $worker,
                                                 requestFactory: $psrFactory,
                                                 streamFactory : $psrFactory,
                                                 uploadsFactory: $psrFactory);
// ... other code here. now the interesting part:
$psr7->respond(status     : 103,
               headers    : ['Link'  => ['</static/css/bootstrap.min.css>; rel=preload; as=style',
                                         '</static/js/bootstrap.bundle.min.js>; rel=preload; as=script']],
               endOfStream: false);
$psr7->respond(status     : 200,
               body       : 'My fancy HTML that took maybe 1 second to create',
               endOfStream: true);
// exceptions following and so on

endOfStream would describe that the response stream shall be closed or not (which has not been implemented yet?).

@Zegnat
Copy link
Collaborator

Zegnat commented Apr 12, 2024

The PSR-7 implementation in this repository does not actually handle any of the sending. We never access the response stream. That is probably handled by the PSR7Worker instance from RoadRunner.

Have you opened an issue there? If you have the Exceptions, those might point out where the stream is actually getting closed?

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

No branches or pull requests

2 participants