On Sun, 15 Jul 2018, at 8:53 PM, Oleg Kalnichevski wrote: > On Sun, 2018-07-15 at 16:36 +1000, Alex Osborne wrote: > > If I receive a server push is it possible to determine which client > > request it was sent in response to? > > Not unless the server is willing to help with that. > > Why do not you add a correlation id of a sort to the promised request > from AsyncPushProducer?
Here's a simplified example of what I want to do. I want to make two requests each having its own directory and save all the corresponding responses (both the main response and any push responses) to the appropriate directory. client.register("*", () -> new FileSavingDataConsumer("/tmp/request??/"))); client.execute(request1, new FileSavingDataConsumer("/tmp/request1/"), null); client.execute(request2, new FileSavingDataConsumer("/tmp/request2/"), null); While I could certainly put a counter in the AsyncPushProducer and mint ids I have no guarantee it'd be called in any particular order so I still wouldn't know which was which. As request1 and request2 are executing concurrently I believe they may produce pushes in any order, possibly even interleaved. I'm pretty sure this is possible in the protocol as RFC 7540 says: Pushed responses are always associated with an explicit request from the client. The PUSH_PROMISE frames sent by the server are sent on that explicit request's stream. I don't think it's possible in the current implementation though as AbstractHttp2StreamMultiplexer doesn't seem to do anything with the explicit request's stream other than checking it hasn't been closed. So I guess I need to figure out how to modify AbstractHttp2StreamMultiplexer to plumb through the information. Cheers, Alex --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org