-
-
Notifications
You must be signed in to change notification settings - Fork 145
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
Allow access to ServerRequest connection for "raw" response? #181
Comments
+1, interested |
I think you can do $downstreamResponse->pipe($originalResponse) or something similar. |
The other way around. |
Thanks for raising this interesting question! I'm not sure I follow, but it looks like you may want to look into examples/4. The I hope this helps 👍 If you feel anything's missing, please provide a simple gist, some pseudo code / overview would be much appreciated and I'm happy to look into this 👍 |
Thank you @clue for looking into this. I've sketched three drafts I could think of that would allow my use case without reinventing larger parts of the server. Option 1 would require some changes to the server response handling, options 2 and 3 require the additional $requestor parameter:
Another valid approach might be subclassing the server instead. Am I making sense here? |
This is very valid use case indeed 👍 However, it's my understanding that this particular code would best be implemented by using an HTTP client in your HTTP request handler so that your server essentially works as a proxy server. The HTTP client will return a "normal" This allows the server to follow "normal" HTTP semantics (request-response-cycle), header validation and automatic This will also be significantly easier once the HTTP client will be merged as part of this package via #148. Do you feel something's missing here or does this cover your use case? 👍 |
I'm closing this issue now. After client has PSR-7 semantics I'll need to recheck if the approach is feasible especially in the light of async body streams. |
We have a use case where we receive HTTP requests for passing to downstream applications- basically a load balancer. That request needs be parsed and headers modified- so a good case for the HTTP server.
For the downstream application I'm not interested in the actual response semantics, I'd just want to pipe back to the original requester what the downstream sends.
Not sure this is entirely too specific, but would it be possible to return e.g. a stream instead of a
Response
for use inServer->handleRequest
?The text was updated successfully, but these errors were encountered: