On Sun, 2018-07-15 at 21:41 +1000, Alex Osborne wrote:
> 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.
>
Given the example you can clearly use the original request request URI
as a correlation id.
> 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 am sure it is possible. Please do refer me to a section of the
specification that states _how_ _exactly_ those messages are associated
other than through the promised request that server pushes to the
client.
> 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.
>
We happily take patches. Will be more than happy to commit a change-set
that makes correlation of push response messages easier.
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]