Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] RST_STREAM Sending

Hi,

On Tue, Sep 22, 2015 at 6:25 PM, Muhui Jiang <jiangmuhui@xxxxxxxxx> wrote:
> Thanks Simone. Here is a code I want to reject to the pushed resource. But
> if I use stream.reset(). I cannot get frames of the index.html only result
> is :

How do you know you cannot get the frames for index.html ?
Is index.html pushed ? Did you return a Stream.Listener for index.html
to the implementation (typically the return value of
Session.onNewStream()) ?

> PushPromiseFrame@36e05d20#1/#2https://127.0.0.1:8081/
>
> GET{u=https://127.0.0.1:8081/img/res/main-text.png,HTTP/2.0,h=1}
>
> 1
>
> 2
>
> I think I just refused to receive the pushed resource and I should get the
> data I made request to. Do you know why?
>
> @Override
>
>             public Stream.Listener onPush(Stream stream, PushPromiseFrame
> frame)
>
>             {
>
>                 System.err.println(frame+"https://"+host+":"+port+"/";);
>
>                 System.out.println(frame.getMetaData());
>
>                 System.out.println(frame.getStreamId());
>
>                 System.out.println(frame.getPromisedStreamId());
>
>                 stream.reset(new ResetFrame(frame.getPromisedStreamId(), 1),
> null);
>
>                 return this;

There is not point in returning a Stream.Listener for a stream that
you just reset.

It's better to reset in this way:

ResetFrame resetFrame = new ResetFrame(stream.getId(),
ErrorCode.REFUSED_STREAM_ERROR.code);
stream.reset(resetFrame, Callback.NOOP);

See https://github.com/eclipse/jetty.project/blob/master/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/PushCacheFilterTest.java#L293

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.


Back to the top